coreutils
[Top][All Lists]
Advanced

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

[PATCH] date: free allocated memory to fix Valgrind warning


From: Daniel Lockyer
Subject: [PATCH] date: free allocated memory to fix Valgrind warning
Date: Tue, 16 Feb 2016 13:42:43 +0000

When running Valgrind to monitor ./src/date, it reports the variable `tz`
isn't freed when the program exits. I simply added a `free(tz)` call
to clean this up.
---
 src/date.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/date.c b/src/date.c
index 3670553..23eef87 100644
--- a/src/date.c
+++ b/src/date.c
@@ -548,6 +548,8 @@ main (int argc, char **argv)
       ok &= show_date (format, when, tz);
     }

+  free(tz);
+
   return ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }

--
2.7.1




reply via email to

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