NetBSD Problem Report #47316
From www@NetBSD.org Thu Dec 13 12:15:40 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id 5DD8163E33E
for <gnats-bugs@gnats.NetBSD.org>; Thu, 13 Dec 2012 12:15:40 +0000 (UTC)
Message-Id: <20121213121539.B395063E33E@www.NetBSD.org>
Date: Thu, 13 Dec 2012 12:15:39 +0000 (UTC)
From: henning.petersen@t-online.de
Reply-To: henning.petersen@t-online.de
To: gnats-bugs@NetBSD.org
Subject: Memory leak in envstat with config file.
X-Send-Pr-Version: www-1.0
>Number: 47316
>Category: bin
>Synopsis: Memory leak in envstat with config file.
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Dec 13 12:20:01 +0000 2012
>Closed-Date: Thu Dec 13 21:54:13 +0000 2012
>Last-Modified: Thu Dec 13 21:54:13 +0000 2012
>Originator: Henning Petersen
>Release: NetBSD-current
>Organization:
>Environment:
>Description:
Memory leak if config file is used.
>How-To-Repeat:
>Fix:
diff -u -p -r1.91 envstat.c
--- usr.sbin/envstat/envstat.c 11 May 2012 18:41:12 -0000 1.91
+++ usr.sbin/envstat/envstat.c 6 Dec 2012 10:58:57 -0000
@@ -264,6 +264,7 @@ int main(int argc, char **argv)
rval = send_dictionary(cf);
(void)fclose(cf);
+ free(configfile);
/* Show sensors with interval */
} else if (interval) {
>Release-Note:
>Audit-Trail:
From: Marc Balmer <marc@msys.ch>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/47316: Memory leak in envstat with config file.
Date: Thu, 13 Dec 2012 13:40:25 +0100
Am 13.12.2012 um 13:20 schrieb henning.petersen@t-online.de:
>> Number: 47316
>> Category: bin
>> Synopsis: Memory leak in envstat with config file.
>> Confidential: no
>> Severity: non-critical
>> Priority: medium
>> Responsible: bin-bug-people
>> State: open
>> Class: sw-bug
>> Submitter-Id: net
>> Arrival-Date: Thu Dec 13 12:20:01 +0000 2012
>> Originator: Henning Petersen
>> Release: NetBSD-current
>> Organization:
>> Environment:
>> Description:
> Memory leak if config file is used.
>> How-To-Repeat:
>=20
>> Fix:
> diff -u -p -r1.91 envstat.c
> --- usr.sbin/envstat/envstat.c 11 May 2012 18:41:12 -0000 =
1.91
> +++ usr.sbin/envstat/envstat.c 6 Dec 2012 10:58:57 -0000
> @@ -264,6 +264,7 @@ int main(int argc, char **argv)
>=20
> rval =3D send_dictionary(cf);
> (void)fclose(cf);
> + free(configfile);
>=20
> /* Show sensors with interval */
> } else if (interval) {
>=20
A free() is not needed here (in fact even more free's can be removed) =
because the program will exit just after that. No need to clean up the =
dishes when the ship is sinking...
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: bin/47316: Memory leak in envstat with config file.
Date: Thu, 13 Dec 2012 15:25:51 +0000
On Thu, Dec 13, 2012 at 12:45:05PM +0000, Marc Balmer wrote:
> A free() is not needed here (in fact even more free's can be removed) =
> because the program will exit just after that. No need to clean up the =
> dishes when the ship is sinking...
No, it is always better to tidy up. You don't know where the sources
might end up being used, and there are/have been platforms where it
can matter. Also it avoids noise when using leak-checking tools.
--
David A. Holland
dholland@netbsd.org
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/47316 CVS commit: src/usr.sbin/envstat
Date: Thu, 13 Dec 2012 14:31:25 -0500
Module Name: src
Committed By: christos
Date: Thu Dec 13 19:31:25 UTC 2012
Modified Files:
src/usr.sbin/envstat: envstat.c
Log Message:
PR/47316: Henning Petersen: Memory leak in envstat with config file.
To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/usr.sbin/envstat/envstat.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Thu, 13 Dec 2012 21:54:13 +0000
State-Changed-Why:
christos committed it, thanks!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.