pf: fix memory leak

The nvlist is allocated in pf_keth_rule_to_nveth_rule(). There's no need
to allocate one in the calling function. Especially not as we overwrite
the pointer to the new nvlist with the one allocated by
pf_keth_rule_to_nveth_rule(), leaking memory.

Reported by:	Coverity
CID:		1476128
Sponsored by:	Rubicon Communications, LLC ("Netgate")
This commit is contained in:
Kristof Provost 2022-04-07 08:35:12 +02:00
parent e85eaa9308
commit 0bd468ea3f

View File

@ -2720,8 +2720,6 @@ DIOCGETETHRULES_error:
free(nvlpacked, M_TEMP);
nvlpacked = NULL;
nvl = nvlist_create(0);
rule = TAILQ_FIRST(rs->active.rules);
while ((rule != NULL) && (rule->nr != nr))
rule = TAILQ_NEXT(rule, entries);