]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output: work around scan-build fp
authorVictor Julien <vjulien@oisf.net>
Tue, 25 Apr 2023 05:23:58 +0000 (07:23 +0200)
committerVictor Julien <vjulien@oisf.net>
Tue, 25 Apr 2023 05:25:59 +0000 (07:25 +0200)
runmodes.c:541:13: warning: Use of memory after it is freed [unix.Malloc]
        if (output->output_ctx != NULL && output->output_ctx->DeInit != NULL)
            ^~~~~~~~~~~~~~~~~~
1 warning generated.

src/runmodes.c

index c36dcf45eeac8cbd50e674f6a5e63f5ef223c8fe..60e68dcd64631d8ddcbb5c723e2981870ef3e50f 100644 (file)
@@ -535,13 +535,11 @@ static void RunOutputFreeList(void)
 {
     OutputFreeList *output;
     while ((output = TAILQ_FIRST(&output_free_list))) {
-        SCLogDebug("output %s %p %p", output->output_module->name, output,
-            output->output_ctx);
+        TAILQ_REMOVE(&output_free_list, output, entries);
 
+        SCLogDebug("output %s %p %p", output->output_module->name, output, output->output_ctx);
         if (output->output_ctx != NULL && output->output_ctx->DeInit != NULL)
             output->output_ctx->DeInit(output->output_ctx);
-
-        TAILQ_REMOVE(&output_free_list, output, entries);
         SCFree(output);
     }
 }