[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint
From: |
Kamil Dudka |
Subject: |
bug#47384: [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
- bug#47384: [PATCH 1/2] hostname: fix a memory leak with -Dlint,
Kamil Dudka <=