From: Joshua Lumb Date: Thu, 13 Aug 2020 13:43:05 +0000 (-0400) Subject: runmodes: memory leak on runmode single X-Git-Tag: suricata-6.0.0-rc1~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6dbc6d66692c64a2dfbc4524f7fe91a9dbd31495;p=thirdparty%2Fsuricata.git runmodes: memory leak on runmode single --- diff --git a/src/runmode-af-packet.c b/src/runmode-af-packet.c index 09f47f6e80..4af254927f 100644 --- a/src/runmode-af-packet.c +++ b/src/runmode-af-packet.c @@ -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 {