]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
runmodes: memory leak on runmode single
authorJoshua Lumb <joshua.lumb@gmail.com>
Thu, 13 Aug 2020 13:43:05 +0000 (09:43 -0400)
committerVictor Julien <victor@inliniac.net>
Thu, 3 Sep 2020 11:01:32 +0000 (13:01 +0200)
src/runmode-af-packet.c

index 09f47f6e8001ac1d3b975dd364f4556f3eed332c..4af254927f74b5239bd3245b616e1386fb8f133c 100644 (file)
@@ -122,6 +122,7 @@ static void *ParseAFPConfig(const char *iface)
     const char *out_iface = NULL;
     int cluster_type = PACKET_FANOUT_HASH;
     const char *ebpf_file = NULL;
+    const char *active_runmode = RunmodeGetActive();
 
     if (iface == NULL) {
         return NULL;
@@ -187,7 +188,9 @@ static void *ParseAFPConfig(const char *iface)
         if_default = NULL;
     }
 
-    if (ConfGetChildValueWithDefault(if_root, if_default, "threads", &threadsstr) != 1) {
+    if (active_runmode && !strcmp("single", active_runmode)) {
+        aconf->threads = 1;
+    } else if (ConfGetChildValueWithDefault(if_root, if_default, "threads", &threadsstr) != 1) {
         aconf->threads = 0;
     } else {
         if (threadsstr != NULL) {
@@ -688,7 +691,6 @@ finalize:
             break;
     }
 
-    char *active_runmode = RunmodeGetActive();
     if (active_runmode && !strcmp("workers", active_runmode)) {
         aconf->flags |= AFP_ZERO_COPY;
     } else {