tls-json: add cleanup function

Properly clean up output context when shutting down.
pull/926/head
Victor Julien 11 years ago
parent 34069054ce
commit b2d29a85e9

@ -212,6 +212,16 @@ static TmEcode JsonTlsLogThreadDeinit(ThreadVars *t, void *data)
return TM_ECODE_OK;
}
static void OutputTlsLogDeinit(OutputCtx *output_ctx)
{
OutputTlsLoggerDisable();
OutputTlsCtx *tls_ctx = output_ctx->data;
LogFileCtx *logfile_ctx = tls_ctx->file_ctx;
LogFileFreeCtx(logfile_ctx);
SCFree(tls_ctx);
SCFree(output_ctx);
}
#define DEFAULT_LOG_FILENAME "tls.json"
OutputCtx *OutputTlsLogInit(ConfNode *conf)
@ -259,11 +269,20 @@ OutputCtx *OutputTlsLogInit(ConfNode *conf)
}
}
output_ctx->data = tls_ctx;
output_ctx->DeInit = NULL;
output_ctx->DeInit = OutputTlsLogDeinit;
return output_ctx;
}
static void OutputTlsLogDeinitSub(OutputCtx *output_ctx)
{
OutputTlsLoggerDisable();
OutputTlsCtx *tls_ctx = output_ctx->data;
SCFree(tls_ctx);
SCFree(output_ctx);
}
OutputCtx *OutputTlsLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
{
AlertJsonThread *ajt = parent_ctx->data;
@ -297,7 +316,7 @@ OutputCtx *OutputTlsLogInitSub(ConfNode *conf, OutputCtx *parent_ctx)
}
}
output_ctx->data = tls_ctx;
output_ctx->DeInit = NULL;
output_ctx->DeInit = OutputTlsLogDeinitSub;
return output_ctx;
}

Loading…
Cancel
Save