pf: Fix a crash in low-memory situations
authorkp <kp@FreeBSD.org>
Mon, 6 Mar 2017 23:41:23 +0000 (23:41 +0000)
committerkp <kp@FreeBSD.org>
Mon, 6 Mar 2017 23:41:23 +0000 (23:41 +0000)
commitc1647fc83c0d28e62596b64b1cc8aa7ca2460a89
tree1b54251094cde0e5e6b6a21d00cd90dba165e6d5
parent36e58885434205df2115f4ed240494ff2bc917df
pf: Fix a crash in low-memory situations

If the call to pf_state_key_clone() in pf_get_translation() fails (i.e. there's
no more memory for it) it frees skp. This is wrong, because skp is a
pf_state_key **, so we need to free *skp, as is done later in the function.
Getting it wrong means we try to free a stack variable of the calling
pf_test_rule() function, and we panic.
sys/netpfil/pf/pf_lb.c