Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sesd/srcs Fix fd leak in error case. Found by cppch...



details:   https://anonhg.NetBSD.org/src/rev/a7d03ff4a0cb
branches:  trunk
changeset: 760403:a7d03ff4a0cb
user:      wiz <wiz%NetBSD.org@localhost>
date:      Tue Jan 04 10:10:39 2011 +0000

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

diffstat:

 usr.sbin/sesd/srcs/sesd.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (17 lines):

diff -r 41dac13a41f9 -r a7d03ff4a0cb usr.sbin/sesd/srcs/sesd.c
--- a/usr.sbin/sesd/srcs/sesd.c Tue Jan 04 10:05:55 2011 +0000
+++ b/usr.sbin/sesd/srcs/sesd.c Tue Jan 04 10:10:39 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sesd.c,v 1.5 2009/04/18 13:57:44 lukem Exp $ */
+/* $NetBSD: sesd.c,v 1.6 2011/01/04 10:10:39 wiz Exp $ */
 /* $FreeBSD: $ */
 /* $OpenBSD: $ */
 /*
@@ -102,6 +102,7 @@
                if (ioctl(fd, SESIOC_INIT, NULL) < 0) {
                        fprintf(stderr, "%s: SESIOC_INIT fails- %s\n",
                            v[dev], strerror(errno));
+                       (void) close(fd);
                        return (1);
                }
                (void) close(fd);



Home | Main Index | Thread Index | Old Index