diff --git a/src/output-json.c b/src/output-json.c index c55875a6758f..1f411cc110b8 100644 --- a/src/output-json.c +++ b/src/output-json.c @@ -1050,9 +1050,11 @@ static int LogFileTypePrepare( &json_ctx->file_ctx->filetype.init_data) < 0) { return -1; } - if (json_ctx->filetype->ThreadInit(json_ctx->file_ctx->filetype.init_data, 0, - &json_ctx->file_ctx->filetype.thread_data) < 0) { - return -1; + if (json_ctx->filetype->ThreadInit) { + if (json_ctx->filetype->ThreadInit(json_ctx->file_ctx->filetype.init_data, 0, + &json_ctx->file_ctx->filetype.thread_data) < 0) { + return -1; + } } json_ctx->file_ctx->filetype.filetype = json_ctx->filetype; } diff --git a/src/util-logopenfile.c b/src/util-logopenfile.c index 2fdbc33c99a0..24063e10954b 100644 --- a/src/util-logopenfile.c +++ b/src/util-logopenfile.c @@ -871,7 +871,7 @@ int LogFileFreeCtx(LogFileCtx *lf_ctx) SCReturnInt(0); } - if (lf_ctx->type == LOGFILE_TYPE_FILETYPE) { + if (lf_ctx->type == LOGFILE_TYPE_FILETYPE && lf_ctx->filetype.filetype->ThreadDeinit) { lf_ctx->filetype.filetype->ThreadDeinit( lf_ctx->filetype.init_data, lf_ctx->filetype.thread_data); }