Skip to content

Commit

Permalink
pfring: fix leak of configuration data and in single mode
Browse files Browse the repository at this point in the history
Fix leak of configuration data on exit. Also, in single mode set
thread count to one instead of the CPU count.

Bug: #4734
  • Loading branch information
jasonish authored and victorjulien committed Feb 28, 2024
1 parent 358f1e3 commit 5f08535
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/runmode-pfring.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ static void *ParsePfringConfig(const char *iface)
cluster_type default_ctype = CLUSTER_FLOW;
int getctype = 0;
int bool_val;
const char *active_runmode = RunmodeGetActive();

if (unlikely(pfconf == NULL)) {
return NULL;
Expand Down Expand Up @@ -244,7 +245,9 @@ static void *ParsePfringConfig(const char *iface)
if_default = NULL;
}

if (ConfGetChildValueWithDefault(if_root, if_default, "threads", &threadsstr) != 1) {
if (active_runmode && !strcmp("single", active_runmode)) {
pfconf->threads = 1;
} else if (ConfGetChildValueWithDefault(if_root, if_default, "threads", &threadsstr) != 1) {
pfconf->threads = 1;
} else if (threadsstr != NULL) {
if (strcmp(threadsstr, "auto") == 0) {
Expand Down
1 change: 1 addition & 0 deletions src/source-pfring.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ TmEcode ReceivePfringThreadDeinit(ThreadVars *tv, void *data)
}

pfring_close(ptv->pd);
SCFree(ptv);
return TM_ECODE_OK;
}

Expand Down

0 comments on commit 5f08535

Please sign in to comment.