diff options
author | melifaro <melifaro@FreeBSD.org> | 2015-04-19 12:49:30 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2015-04-19 12:49:30 +0000 |
commit | 240f0e9a46a69e86979ea5300fa84b96a1e0f96d (patch) | |
tree | 87729e7baadf3c58abbc9fbda01c2edca388fd40 | |
parent | d9ba2b8e840dee9f2a11552ae25b13cbf7acd2aa (diff) | |
download | FreeBSD-src-240f0e9a46a69e86979ea5300fa84b96a1e0f96d.zip FreeBSD-src-240f0e9a46a69e86979ea5300fa84b96a1e0f96d.tar.gz |
Fix use-after-free.
Reported by: Coverity Scan, pfg
CID: 1245747
-rw-r--r-- | sbin/ipfw/nat.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sbin/ipfw/nat.c b/sbin/ipfw/nat.c index 4391778..184b172 100644 --- a/sbin/ipfw/nat.c +++ b/sbin/ipfw/nat.c @@ -1008,11 +1008,10 @@ nat_foreach(nat_cb_t *f, void *arg, int sort) olh->size = sz; if (do_get3(IP_FW_NAT44_LIST_NAT, &olh->opheader, &sz) != 0) { + sz = olh->size; free(olh); - if (errno == ENOMEM) { - sz = olh->size; + if (errno == ENOMEM) continue; - } return (errno); } |