http-json: add missing cleanup functions

Add cleanup functions.
pull/926/head
Victor Julien 11 years ago
parent 7ffd227133
commit 3a6be9772f

@ -232,6 +232,15 @@ static int JsonHttpLogger(ThreadVars *tv, void *thread_data, const Packet *p, Fl
SCReturnInt(TM_ECODE_OK);
}
static void OutputHttpLogDeinit(OutputCtx *output_ctx)
{
LogHttpFileCtx *http_ctx = output_ctx->data;
LogFileCtx *logfile_ctx = http_ctx->file_ctx;
LogFileFreeCtx(logfile_ctx);
SCFree(http_ctx);
SCFree(output_ctx);
}
#define DEFAULT_LOG_FILENAME "http.json"
OutputCtx *OutputHttpLogInit(ConfNode *conf)
{
@ -272,7 +281,7 @@ OutputCtx *OutputHttpLogInit(ConfNode *conf)
}
}
output_ctx->data = http_ctx;
output_ctx->DeInit = NULL;
output_ctx->DeInit = OutputHttpLogDeinit;
/* enable the logger for the app layer */
AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP);
@ -280,6 +289,13 @@ OutputCtx *OutputHttpLogInit(ConfNode *conf)
return output_ctx;
}
static void OutputHttpLogDeinitSub(OutputCtx *output_ctx)
{
LogHttpFileCtx *http_ctx = output_ctx->data;
SCFree(http_ctx);
SCFree(output_ctx);
}
OutputCtx *OutputHttpLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
{
AlertJsonThread *ajt = parent_ctx->data;
@ -307,7 +323,7 @@ OutputCtx *OutputHttpLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
}
}
output_ctx->data = http_ctx;
output_ctx->DeInit = NULL;
output_ctx->DeInit = OutputHttpLogDeinitSub;
/* enable the logger for the app layer */
AppLayerParserRegisterLogger(IPPROTO_TCP, ALPROTO_HTTP);

Loading…
Cancel
Save