aboutsummaryrefslogtreecommitdiff
path: root/sbin/ipfw/nat.c
diff options
context:
space:
mode:
authorAlexander V. Chernikov <melifaro@FreeBSD.org>2015-04-19 12:49:30 +0000
committerAlexander V. Chernikov <melifaro@FreeBSD.org>2015-04-19 12:49:30 +0000
commit0577d6e0d5e065c23f1ac14a48b009c9afe892d7 (patch)
tree87729e7baadf3c58abbc9fbda01c2edca388fd40 /sbin/ipfw/nat.c
parentafdfc9a40df88c758093a8f85c34fe6a66ffe0dc (diff)
downloadsrc-0577d6e0d5e065c23f1ac14a48b009c9afe892d7.tar.gz
src-0577d6e0d5e065c23f1ac14a48b009c9afe892d7.zip
Fix use-after-free.
Reported by: Coverity Scan, pfg CID: 1245747
Notes
Notes: svn path=/head/; revision=281740
Diffstat (limited to 'sbin/ipfw/nat.c')
-rw-r--r--sbin/ipfw/nat.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sbin/ipfw/nat.c b/sbin/ipfw/nat.c
index 439177875e22..184b17215fb8 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);
}