mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-27 11:55:06 +00:00
pf: Fix memory leak in DIOCRADDTABLES
If a user attempts to add two tables with the same name the duplicate table will not be added, but we forgot to free the duplicate table, leaking memory. Ensure we free the duplicate table in the error path. Reported by: Coverity CID: 1382111 MFC after: 3 weeks
This commit is contained in:
parent
7d48aa4c72
commit
b4b8fa3387
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=331225
@ -1131,8 +1131,10 @@ pfr_add_tables(struct pfr_table *tbl, int size, int *nadd, int flags)
|
||||
if (p == NULL)
|
||||
senderr(ENOMEM);
|
||||
SLIST_FOREACH(q, &addq, pfrkt_workq) {
|
||||
if (!pfr_ktable_compare(p, q))
|
||||
if (!pfr_ktable_compare(p, q)) {
|
||||
pfr_destroy_ktable(p, 0);
|
||||
goto _skip;
|
||||
}
|
||||
}
|
||||
SLIST_INSERT_HEAD(&addq, p, pfrkt_workq);
|
||||
xadd++;
|
||||
|
Loading…
Reference in New Issue
Block a user