diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -4731,6 +4731,11 @@ return (action); } } else { + while ((ri = SLIST_FIRST(&match_rules))) { + SLIST_REMOVE_HEAD(&match_rules, entry); + free(ri, M_PF_RULE_ITEM); + } + uma_zfree(V_pf_state_key_z, sk); uma_zfree(V_pf_state_key_z, nk); } @@ -4776,6 +4781,7 @@ struct tcphdr *th = &pd->hdr.tcp; u_int16_t mss = V_tcp_mssdflt; u_short reason, sn_reason; + struct pf_krule_item *ri; /* check maximums */ if (r->max_states && @@ -4986,6 +4992,11 @@ return (PF_PASS); csfailed: + while ((ri = SLIST_FIRST(match_rules))) { + SLIST_REMOVE_HEAD(match_rules, entry); + free(ri, M_PF_RULE_ITEM); + } + uma_zfree(V_pf_state_key_z, sk); uma_zfree(V_pf_state_key_z, nk);