From 4e9be51849804b8dca66f3c00e250572e3d6e9bb Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Fri, 20 Feb 2015 11:08:32 +0000 Subject: 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 --- sys/net/pf_ioctl.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'sys/net') 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; } -- cgit v1.2.3