]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
runmodes: fix memory leak
authorPhilippe Antoine <pantoine@oisf.net>
Wed, 25 Jan 2023 14:01:52 +0000 (15:01 +0100)
committerVictor Julien <vjulien@oisf.net>
Thu, 26 Jan 2023 05:57:15 +0000 (06:57 +0100)
By using constant for string instead of allocating and leaking it

CID: 1520497
CID: 1520500

src/runmodes.c

index ce0baf63292c4c851fa2d7412ab417b1aaeaee46..2b29b3314c49a0050f9ec99c94e818735eea6542 100644 (file)
@@ -384,14 +384,9 @@ static const char *RunModeGetConfOrDefault(int capture_mode, const char *capture
     } else {
         /* Add compability with old 'worker' name */
         if (!strcmp("worker", custom_mode)) {
-            char *local_custom_mode = NULL;
             SCLogWarning("'worker' mode have been renamed "
                          "to 'workers', please modify your setup.");
-            local_custom_mode = SCStrdup("workers");
-            if (unlikely(local_custom_mode == NULL)) {
-                FatalError("Unable to dup custom mode");
-            }
-            custom_mode = local_custom_mode;
+            custom_mode = "workers";
         }
     }