Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/altq/libaltq Fix fd leak in error case. Found by cp...



details:   https://anonhg.NetBSD.org/src/rev/e22b8cbf9e90
branches:  trunk
changeset: 760391:e22b8cbf9e90
user:      wiz <wiz%NetBSD.org@localhost>
date:      Tue Jan 04 09:14:42 2011 +0000

description:
Fix fd leak in error case. Found by cppcheck.

diffstat:

 usr.sbin/altq/libaltq/qop.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (25 lines):

diff -r 591994b2cb3d -r e22b8cbf9e90 usr.sbin/altq/libaltq/qop.c
--- a/usr.sbin/altq/libaltq/qop.c       Tue Jan 04 09:13:56 2011 +0000
+++ b/usr.sbin/altq/libaltq/qop.c       Tue Jan 04 09:14:42 2011 +0000
@@ -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 @@
 
        if (ioctl(fd, RED_SETDEFAULTS, &params) < 0) {
                LOG(LOG_ERR, errno, "RED_SETDEFAULTS");
+               (void)close(fd);
                return (QOPERR_SYSCALL);
        }
 
@@ -1392,6 +1393,7 @@
 
        if (ioctl(fd, RIO_SETDEFAULTS, params) < 0) {
                LOG(LOG_ERR, errno, "RIO_SETDEFAULTS");
+               (void)close(fd);
                return (QOPERR_SYSCALL);
        }
 



Home | Main Index | Thread Index | Old Index