emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#47384: closed ([PATCH 1/2] hostname: fix a memory leak with -Dlint)


From: GNU bug Tracking System
Subject: bug#47384: closed ([PATCH 1/2] hostname: fix a memory leak with -Dlint)
Date: Thu, 25 Mar 2021 18:23:02 +0000

Your message dated Thu, 25 Mar 2021 11:22:33 -0700
with message-id <3d31ec68-9fef-5359-bf3b-3446a5772a35@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@gnu.org.)


-- 
47384: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=47384
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- 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




--- End Message ---
--- Begin Message --- Subject: Re: bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint Date: Thu, 25 Mar 2021 11:22:33 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1
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.

Attachment: 0001-hostname-pacify-valgrind.patch
Description: Text Data


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]