Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/gmon Fix fdleak in #ifdef DEBUG. Found by cppcheck.



details:   https://anonhg.NetBSD.org/src/rev/cb7d2aab1470
branches:  trunk
changeset: 760438:cb7d2aab1470
user:      wiz <wiz%NetBSD.org@localhost>
date:      Wed Jan 05 00:03:52 2011 +0000

description:
Fix fdleak in #ifdef DEBUG. Found by cppcheck.

diffstat:

 lib/libc/gmon/gmon.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r bb60e242a3ad -r cb7d2aab1470 lib/libc/gmon/gmon.c
--- a/lib/libc/gmon/gmon.c      Tue Jan 04 23:48:44 2011 +0000
+++ b/lib/libc/gmon/gmon.c      Wed Jan 05 00:03:52 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gmon.c,v 1.32 2010/03/01 19:52:38 christos Exp $       */
+/*     $NetBSD: gmon.c,v 1.33 2011/01/05 00:03:52 wiz Exp $    */
 
 /*
  * Copyright (c) 2003, 2004 Wasabi Systems, Inc.
@@ -69,7 +69,7 @@
 #if 0
 static char sccsid[] = "@(#)gmon.c     8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: gmon.c,v 1.32 2010/03/01 19:52:38 christos Exp $");
+__RCSID("$NetBSD: gmon.c,v 1.33 2011/01/05 00:03:52 wiz Exp $");
 #endif
 #endif
 
@@ -441,6 +441,7 @@
        logfd = open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664);
        if (logfd < 0) {
                warn("%s: Cannot open `%s'", __func__, "gmon.log");
+               (void)close(fd);
                return;
        }
        len = snprintf(buf2, sizeof buf2, "[mcleanup1] kcount %p ssiz %lu\n",



Home | Main Index | Thread Index | Old Index