From 6b56d5971a61947c93030532ca4da28099fa75c0 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Fri, 21 Jun 2024 19:32:32 +0200 Subject: [PATCH] output/tx: use dynamic number of app-layer protos OutputTxLoggerThreadData gets allocated after the number of app-layer protos is definite --- src/output-tx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/output-tx.c b/src/output-tx.c index 671829fb75..7bc569ef90 100644 --- a/src/output-tx.c +++ b/src/output-tx.c @@ -35,12 +35,11 @@ /** per thread data for this module, contains a list of per thread * data for the packet loggers. */ typedef struct OutputTxLoggerThreadData_ { - OutputLoggerThreadStore *store[ALPROTO_MAX]; - /* thread local data from file api */ OutputFileLoggerThreadData *file; /* thread local data from filedata api */ OutputFiledataLoggerThreadData *filedata; + OutputLoggerThreadStore *store[]; } OutputTxLoggerThreadData; /* logger instance, a module + a output ctx, @@ -542,7 +541,8 @@ end: * loggers */ static TmEcode OutputTxLogThreadInit(ThreadVars *tv, const void *_initdata, void **data) { - OutputTxLoggerThreadData *td = SCCalloc(1, sizeof(*td)); + OutputTxLoggerThreadData *td = + SCCalloc(1, sizeof(*td) + ALPROTO_MAX * sizeof(OutputLoggerThreadStore *)); if (td == NULL) return TM_ECODE_FAILED; -- 2.47.2