Skip to content

Commit

Permalink
pf: fix memory leak retrieving Ethernet rules
Browse files Browse the repository at this point in the history
Remember to free the nvlist we've added to our main nvlist.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
  • Loading branch information
kprovost committed Sep 27, 2022
1 parent e437991 commit 0044bd9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sys/netpfil/pf/pf_nv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1067,13 +1067,15 @@ pf_keth_rule_to_nveth_rule(const struct pf_keth_rule *krule)
return (NULL);
}
nvlist_add_nvlist(nvl, "src", addr);
nvlist_destroy(addr);

addr = pf_keth_rule_addr_to_nveth_rule_addr(&krule->dst);
if (addr == NULL) {
nvlist_destroy(nvl);
return (NULL);
}
nvlist_add_nvlist(nvl, "dst", addr);
nvlist_destroy(addr);

addr = pf_rule_addr_to_nvrule_addr(&krule->ipsrc);
if (addr == NULL) {
Expand Down

0 comments on commit 0044bd9

Please sign in to comment.