From: Victor Julien Date: Thu, 10 Apr 2014 06:35:51 +0000 (+0200) Subject: http-json: add missing cleanup functions X-Git-Tag: suricata-2.0.1rc1~61 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3a6be9772f73f160bd0292fa5490de4511ba461f;p=thirdparty%2Fsuricata.git http-json: add missing cleanup functions Add cleanup functions. --- diff --git a/src/output-json-http.c b/src/output-json-http.c index 7aca281fde..e2d5270cdf 100644 --- a/src/output-json-http.c +++ b/src/output-json-http.c @@ -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);