Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/pstat Fix memory leak in error case. Found by cppch...
details: https://anonhg.NetBSD.org/src/rev/c629289b8af7
branches: trunk
changeset: 760400:c629289b8af7
user: wiz <wiz%NetBSD.org@localhost>
date: Tue Jan 04 09:58:03 2011 +0000
description:
Fix memory leak in error case. Found by cppcheck.
diffstat:
usr.sbin/pstat/pstat.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diffs (26 lines):
diff -r a08be9c011f1 -r c629289b8af7 usr.sbin/pstat/pstat.c
--- a/usr.sbin/pstat/pstat.c Tue Jan 04 09:49:16 2011 +0000
+++ b/usr.sbin/pstat/pstat.c Tue Jan 04 09:58:03 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pstat.c,v 1.116 2009/11/19 02:52:54 enami Exp $ */
+/* $NetBSD: pstat.c,v 1.117 2011/01/04 09:58:03 wiz Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)pstat.c 8.16 (Berkeley) 5/9/95";
#else
-__RCSID("$NetBSD: pstat.c,v 1.116 2009/11/19 02:52:54 enami Exp $");
+__RCSID("$NetBSD: pstat.c,v 1.117 2011/01/04 09:58:03 wiz Exp $");
#endif
#endif /* not lint */
@@ -926,6 +926,7 @@
err(1, "malloc");
if (sysctl(mib, 6, buf + offset, &len, NULL, 0) == -1) {
warn("sysctl: 2nd KERN_FILE2");
+ free(buf);
return (-1);
}
*abuf = buf;
Home |
Main Index |
Thread Index |
Old Index