Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/ldpd CID 1125876: File descriptor leak



details:   https://anonhg.NetBSD.org/src/rev/632ebdb7cfae
branches:  trunk
changeset: 791333:632ebdb7cfae
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Nov 13 21:20:21 2013 +0000

description:
CID 1125876: File descriptor leak

diffstat:

 usr.sbin/ldpd/conffile.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 4e20f7d35623 -r 632ebdb7cfae usr.sbin/ldpd/conffile.c
--- a/usr.sbin/ldpd/conffile.c  Wed Nov 13 21:19:17 2013 +0000
+++ b/usr.sbin/ldpd/conffile.c  Wed Nov 13 21:20:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: conffile.c,v 1.8 2013/10/18 14:14:14 kefren Exp $ */
+/* $NetBSD: conffile.c,v 1.9 2013/11/13 21:20:21 christos Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -121,8 +121,10 @@
 
        if (confh == -1 || fstat(confh, &fs) == -1 ||
            (mapped = mmap(NULL, fs.st_size, PROT_READ, MAP_SHARED, confh, 0))
-           == MAP_FAILED)
+           == MAP_FAILED) {
+               close(confh);
                return E_CONF_IO;
+       }
 
        mapsize = fs.st_size;
        nextline = mapped;



Home | Main Index | Thread Index | Old Index