json-drop-log: clean up memory at shutdown

pull/1880/head
Victor Julien 10 years ago
parent 3c788a8c17
commit 609cdff540

@ -218,12 +218,21 @@ static TmEcode JsonDropLogThreadDeinit(ThreadVars *t, void *data)
return TM_ECODE_OK; return TM_ECODE_OK;
} }
static void JsonDropOutputCtxFree(JsonDropOutputCtx *drop_ctx)
{
if (drop_ctx != NULL) {
if (drop_ctx->file_ctx != NULL)
LogFileFreeCtx(drop_ctx->file_ctx);
SCFree(drop_ctx);
}
}
static void JsonDropLogDeInitCtx(OutputCtx *output_ctx) static void JsonDropLogDeInitCtx(OutputCtx *output_ctx)
{ {
OutputDropLoggerDisable(); OutputDropLoggerDisable();
LogFileCtx *logfile_ctx = (LogFileCtx *)output_ctx->data; JsonDropOutputCtx *drop_ctx = output_ctx->data;
LogFileFreeCtx(logfile_ctx); JsonDropOutputCtxFree(drop_ctx);
SCFree(output_ctx); SCFree(output_ctx);
} }
@ -231,19 +240,12 @@ static void JsonDropLogDeInitCtxSub(OutputCtx *output_ctx)
{ {
OutputDropLoggerDisable(); OutputDropLoggerDisable();
JsonDropOutputCtx *drop_ctx = output_ctx->data;
SCFree(drop_ctx);
SCLogDebug("cleaning up sub output_ctx %p", output_ctx); SCLogDebug("cleaning up sub output_ctx %p", output_ctx);
SCFree(output_ctx); SCFree(output_ctx);
} }
static void JsonDropOutputCtxFree(JsonDropOutputCtx *drop_ctx)
{
if (drop_ctx != NULL) {
if (drop_ctx->file_ctx != NULL)
LogFileFreeCtx(drop_ctx->file_ctx);
SCFree(drop_ctx);
}
}
#define DEFAULT_LOG_FILENAME "drop.json" #define DEFAULT_LOG_FILENAME "drop.json"
static OutputCtx *JsonDropLogInitCtx(ConfNode *conf) static OutputCtx *JsonDropLogInitCtx(ConfNode *conf)
{ {

Loading…
Cancel
Save