GNU bug report logs - #47384
[PATCH 1/2] hostname: fix a memory leak with -Dlint

Previous Next

Package: coreutils;

Reported by: Kamil Dudka <kdudka <at> redhat.com>

Date: Thu, 25 Mar 2021 10:59:02 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#47384: closed ([PATCH 1/2] hostname: fix a memory leak with
 -Dlint)
Date: Thu, 25 Mar 2021 18:23:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 25 Mar 2021 11:22:33 -0700
with message-id <3d31ec68-9fef-5359-bf3b-3446a5772a35 <at> cs.ucla.edu>
and subject line Re: bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint
has caused the debbugs.gnu.org bug report #47384,
regarding [PATCH 1/2] hostname: fix a memory leak with -Dlint
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
47384: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=47384
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Kamil Dudka <kdudka <at> redhat.com>
To: bug-coreutils <at> gnu.org
Subject: [PATCH 1/2] hostname: fix a memory leak with -Dlint
Date: Thu, 25 Mar 2021 11:57:55 +0100
* src/hostname.c (main): Free allocated memory when compiled
with -Dlint.
---
 src/hostname.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/hostname.c b/src/hostname.c
index 7d13575d4e9..8ec9aad4d34 100644
--- a/src/hostname.c
+++ b/src/hostname.c
@@ -104,6 +104,9 @@ main (int argc, char **argv)
       if (hostname == NULL)
         die (EXIT_FAILURE, errno, _("cannot determine hostname"));
       printf ("%s\n", hostname);
+#ifdef lint
+      free(hostname);
+#endif
     }
 
   if (optind + 1 < argc)
-- 
2.26.3



[Message part 3 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Kamil Dudka <kdudka <at> redhat.com>
Cc: 47384-done <at> debbugs.gnu.org
Subject: Re: bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint
Date: Thu, 25 Mar 2021 11:22:33 -0700
[Message part 4 (text/plain, inline)]
On 3/25/21 11:16 AM, Paul Eggert wrote:
> I'd prefer it to use IF_LINT (as in the earlier 
> change), as that makes it cleaner since it's just one line of useless 
> code, not three.

Installed as attached, and closing the bug report. Thanks again.
[0001-hostname-pacify-valgrind.patch (text/x-patch, attachment)]

This bug report was last modified 4 years and 55 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.