summaryrefslogtreecommitdiff
path: root/sys/net
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-02-20 11:08:32 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-02-20 11:08:32 +0000
commit4e9be51849804b8dca66f3c00e250572e3d6e9bb (patch)
tree5ade2ba0cfd188778458fd8f4b9ff8b3c25defa5 /sys/net
parent0ee977038256491aa324b89f054d4feedc4e67c2 (diff)
fix a memory leak in the error case found by Maxime Villard's Brainy
code scanner. Changing return to break also fixes a failure to unlock. Also fix a NULL check for that variable noticed by bluhm. ok bluhm henning millert
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/pf_ioctl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c
index 27237b74f45..cdb13b06f4b 100644
--- a/sys/net/pf_ioctl.c
+++ b/sys/net/pf_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_ioctl.c,v 1.282 2015/02/10 06:45:55 henning Exp $ */
+/* $OpenBSD: pf_ioctl.c,v 1.283 2015/02/20 11:08:31 tedu Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1032,10 +1032,14 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
bcopy(&q->queue, qs, sizeof(*qs));
qs->qid = pf_qname2qid(qs->qname, 1);
if (qs->parent[0] && (qs->parent_qid =
- pf_qname2qid(qs->parent, 0)) == 0)
- return (ESRCH);
+ pf_qname2qid(qs->parent, 0)) == 0) {
+ pool_put(&pf_queue_pl, qs);
+ error = ESRCH;
+ break;
+ }
qs->kif = pfi_kif_get(qs->ifname);
- if (!qs->kif->pfik_ifp) {
+ if (qs->kif == NULL) {
+ pool_put(&pf_queue_pl, qs);
error = ESRCH;
break;
}