Do not leak memory while flushing rules.

Noticed by:	yar
Approved by:	glebius (mentor)
MFC after:	1 week
This commit is contained in:
oleg 2006-08-02 14:58:51 +00:00
parent fb3cc7e20d
commit 8cf9fe1408

View File

@ -3957,9 +3957,10 @@ ipfw_ctl(struct sockopt *sopt)
IPFW_WLOCK(&layer3_chain);
layer3_chain.reap = NULL;
free_chain(&layer3_chain, 0 /* keep default rule */);
rule = layer3_chain.reap, layer3_chain.reap = NULL;
rule = layer3_chain.reap;
layer3_chain.reap = NULL;
IPFW_WUNLOCK(&layer3_chain);
if (layer3_chain.reap != NULL)
if (rule != NULL)
reap_rules(rule);
break;