summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-07-10 01:07:57 +0100
committerPádraig Brady <P@draigBrady.com>2013-07-12 00:24:13 +0100
commit90e0e9bf58fd5c9b6aa86c22c6351d830ed1c6eb (patch)
tree3d034cd4df3cd3e51dbc69bd0138bea1aec4877b /src
parent3ebc58cc4370567be7301e02b661a2fe5478d86c (diff)
downloadcoreutils-90e0e9bf58fd5c9b6aa86c22c6351d830ed1c6eb.tar.xz
maint: avoid a valgrind memory leak warning from pinky
Similarly to commit v8.21-84-g8d2da3f in src/uptime.c avoid a "definitely lost" error from valgrind. Note this only happens with pinky when compiled without optimization, in which case certain paths aren't eliminated casuing valgrind to trigger the message. Note also that coverity flags this "resource leak" too. * src/pinky.c (short_pinky): free utmp_buf for developer builds.
Diffstat (limited to 'src')
-rw-r--r--src/pinky.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pinky.c b/src/pinky.c
index e6838ae69..500f70a8b 100644
--- a/src/pinky.c
+++ b/src/pinky.c
@@ -466,12 +466,14 @@ short_pinky (const char *filename,
const int argc_names, char *const argv_names[])
{
size_t n_users;
- STRUCT_UTMP *utmp_buf;
+ STRUCT_UTMP *utmp_buf = NULL;
if (read_utmp (filename, &n_users, &utmp_buf, 0) != 0)
error (EXIT_FAILURE, errno, "%s", filename);
scan_entries (n_users, utmp_buf, argc_names, argv_names);
+
+ IF_LINT (free (utmp_buf));
}
static void