]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output: harden output deinit
authorVictor Julien <victor@inliniac.net>
Sun, 15 Oct 2017 19:25:07 +0000 (21:25 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 16 Oct 2017 12:10:05 +0000 (14:10 +0200)
If thread setup fails allow output deinit code to be called with
NULL data without crashing.

src/output.c

index 4919c3c0a2ea683f85bc8950ec7e75a76c6c9b0d..2c8516f095accbb2d54d09c5cd0f684f7c32a052 100644 (file)
@@ -953,6 +953,9 @@ TmEcode OutputLoggerThreadInit(ThreadVars *tv, const void *initdata, void **data
 
 TmEcode OutputLoggerThreadDeinit(ThreadVars *tv, void *thread_data)
 {
+    if (thread_data == NULL)
+        return TM_ECODE_FAILED;
+
     LoggerThreadStore *thread_store = (LoggerThreadStore *)thread_data;
     RootLogger *logger = TAILQ_FIRST(&RootLoggers);
     LoggerThreadStoreNode *thread_store_node = TAILQ_FIRST(thread_store);