From baacf5e062c089f7f6195c28dddb65f0b69a7bf7 Mon Sep 17 00:00:00 2001 From: wiz Date: Tue, 4 Jan 2011 09:14:42 +0000 Subject: [PATCH] Fix fd leak in error case. Found by cppcheck. --- usr.sbin/altq/libaltq/qop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/altq/libaltq/qop.c b/usr.sbin/altq/libaltq/qop.c index f14e4ecc4312..86fc533a957b 100644 --- a/usr.sbin/altq/libaltq/qop.c +++ b/usr.sbin/altq/libaltq/qop.c @@ -1,4 +1,4 @@ -/* $NetBSD: qop.c,v 1.9 2008/05/02 19:07:44 xtraeme Exp $ */ +/* $NetBSD: qop.c,v 1.10 2011/01/04 09:14:42 wiz Exp $ */ /* $KAME: qop.c,v 1.11 2001/10/26 04:57:59 kjc Exp $ */ /* * Copyright (C) 1999-2000 @@ -1366,6 +1366,7 @@ qop_red_set_defaults(int th_min, int th_max, int inv_pmax) if (ioctl(fd, RED_SETDEFAULTS, ¶ms) < 0) { LOG(LOG_ERR, errno, "RED_SETDEFAULTS"); + (void)close(fd); return (QOPERR_SYSCALL); } @@ -1392,6 +1393,7 @@ qop_rio_set_defaults(struct redparams *params) if (ioctl(fd, RIO_SETDEFAULTS, params) < 0) { LOG(LOG_ERR, errno, "RIO_SETDEFAULTS"); + (void)close(fd); return (QOPERR_SYSCALL); }