]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
runmodes: fix memleak
authorEric Leblond <eric@regit.org>
Fri, 4 Mar 2016 17:03:54 +0000 (18:03 +0100)
committerEric Leblond <eric@regit.org>
Mon, 7 Mar 2016 22:12:07 +0000 (23:12 +0100)
active_runmode value was leaking in unix socket mode.

src/runmodes.c

index 998780d8b4bbdfc7f58229a7584e77095a7a330a..d9e06af785217f1b997cbfee64d6439e42f4fbf6 100644 (file)
@@ -360,6 +360,9 @@ void RunModeDispatch(int runmode, const char *custom_mode)
     }
 
     /* Export the custom mode */
+    if (active_runmode) {
+        SCFree(active_runmode);
+    }
     active_runmode = SCStrdup(custom_mode);
     if (unlikely(active_runmode == NULL)) {
         SCLogError(SC_ERR_MEM_ALLOC, "Unable to dup active mode");