diff --git a/src/output-file.c b/src/output-file.c index c9a71444d3..0a99b06038 100644 --- a/src/output-file.c +++ b/src/output-file.c @@ -241,8 +241,10 @@ static TmEcode OutputFileLogThreadDeinit(ThreadVars *tv, void *thread_data) { tm_module->ThreadDeinit(tv, store->thread_data); } + OutputLoggerThreadStore *next_store = store->next; + SCFree(store); + store = next_store; logger = logger->next; - store = store->next; } return TM_ECODE_OK; } @@ -282,8 +284,10 @@ void OutputFileShutdown(void) { OutputFileLogger *logger = list; while (logger) { - if (logger->output_ctx != NULL && logger->output_ctx->DeInit != NULL) - logger->output_ctx->DeInit(logger->output_ctx); - logger = logger->next; + OutputFileLogger *next_logger = logger->next; + SCFree(logger); + logger = next_logger; } + + list = NULL; } diff --git a/src/output-filedata.c b/src/output-filedata.c index d0770cfa57..946b601f79 100644 --- a/src/output-filedata.c +++ b/src/output-filedata.c @@ -396,8 +396,10 @@ static TmEcode OutputFiledataLogThreadDeinit(ThreadVars *tv, void *thread_data) tm_module->ThreadDeinit(tv, store->thread_data); } + OutputLoggerThreadStore *next_store = store->next; + SCFree(store); + store = next_store; logger = logger->next; - store = store->next; } SCMutexLock(&g_waldo_mutex); @@ -444,3 +446,15 @@ void TmModuleFiledataLoggerRegister (void) { SC_ATOMIC_INIT(file_id); } + +void OutputFiledataShutdown(void) +{ + OutputFiledataLogger *logger = list; + while (logger) { + OutputFiledataLogger *next_logger = logger->next; + SCFree(logger); + logger = next_logger; + } + + list = NULL; +} diff --git a/src/output-filedata.h b/src/output-filedata.h index 334ad60d23..8900cd489d 100644 --- a/src/output-filedata.h +++ b/src/output-filedata.h @@ -45,4 +45,6 @@ int OutputRegisterFiledataLogger(const char *name, FiledataLogger LogFunc, Outpu void TmModuleFiledataLoggerRegister (void); +void OutputFiledataShutdown(void); + #endif /* __OUTPUT_FILE_H__ */ diff --git a/src/output-packet.c b/src/output-packet.c index d575232d8a..3f96f8eb56 100644 --- a/src/output-packet.c +++ b/src/output-packet.c @@ -181,8 +181,11 @@ static TmEcode OutputPacketLogThreadDeinit(ThreadVars *tv, void *thread_data) { tm_module->ThreadDeinit(tv, store->thread_data); } + OutputLoggerThreadStore *next_store = store->next; + SCFree(store); + store = next_store; + logger = logger->next; - store = store->next; } return TM_ECODE_OK; } @@ -222,11 +225,11 @@ void OutputPacketShutdown(void) { OutputPacketLogger *logger = list; while (logger) { - if (logger->output_ctx != NULL && logger->output_ctx->DeInit != NULL) - logger->output_ctx->DeInit(logger->output_ctx); - logger = logger->next; + OutputPacketLogger *next_logger = logger->next; + SCFree(logger); + logger = next_logger; } - /* FIXME */ + /* reset list pointer */ list = NULL; } diff --git a/src/output-tx.c b/src/output-tx.c index 3322277d25..06c20823c1 100644 --- a/src/output-tx.c +++ b/src/output-tx.c @@ -248,8 +248,10 @@ static TmEcode OutputTxLogThreadDeinit(ThreadVars *tv, void *thread_data) { tm_module->ThreadDeinit(tv, store->thread_data); } + OutputLoggerThreadStore *next_store = store->next; + SCFree(store); + store = next_store; logger = logger->next; - store = store->next; } return TM_ECODE_OK; } @@ -289,8 +291,9 @@ void OutputTxShutdown(void) { OutputTxLogger *logger = list; while (logger) { - if (logger->output_ctx != NULL && logger->output_ctx->DeInit != NULL) - logger->output_ctx->DeInit(logger->output_ctx); - logger = logger->next; + OutputTxLogger *next_logger = logger->next; + SCFree(logger); + logger = next_logger; } + list = NULL; }