eve: threadinit/deinit callbacks are optional for filetypes

Only call ThreadInit and ThreadDeinit for custom eve filetypes if they
exist. They are not required by all filetypes.

Ticket: #7359
pull/12074/head
Jason Ish 4 months ago committed by Victor Julien
parent 292c218a48
commit b1e7917d4f

@ -1050,9 +1050,11 @@ static int LogFileTypePrepare(
&json_ctx->file_ctx->filetype.init_data) < 0) { &json_ctx->file_ctx->filetype.init_data) < 0) {
return -1; return -1;
} }
if (json_ctx->filetype->ThreadInit(json_ctx->file_ctx->filetype.init_data, 0, if (json_ctx->filetype->ThreadInit) {
&json_ctx->file_ctx->filetype.thread_data) < 0) { if (json_ctx->filetype->ThreadInit(json_ctx->file_ctx->filetype.init_data, 0,
return -1; &json_ctx->file_ctx->filetype.thread_data) < 0) {
return -1;
}
} }
json_ctx->file_ctx->filetype.filetype = json_ctx->filetype; json_ctx->file_ctx->filetype.filetype = json_ctx->filetype;
} }

@ -871,7 +871,7 @@ int LogFileFreeCtx(LogFileCtx *lf_ctx)
SCReturnInt(0); 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.filetype->ThreadDeinit(
lf_ctx->filetype.init_data, lf_ctx->filetype.thread_data); lf_ctx->filetype.init_data, lf_ctx->filetype.thread_data);
} }

Loading…
Cancel
Save