diff options
author | Anton Ovchinnikov <revolver112@gmail.com> | 2013-07-07 10:29:27 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2013-07-07 10:45:39 +0100 |
commit | 8d2da3f58a82bd1813ca5c06f5692ad60a00559c (patch) | |
tree | 666152d7f9450be73c0da7367b255dd2254dd348 | |
parent | c7dd45361ca1fb3dab63c70cced4546de3b53988 (diff) | |
download | coreutils-8d2da3f58a82bd1813ca5c06f5692ad60a00559c.tar.xz |
maint: avoid a valgrind memory leak warning from uptime
* src/uptime.c (uptime): Free utmp_buf returned from read_utmp,
to avoid a "definitely lost" warning from valgrind.
-rw-r--r-- | src/uptime.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/uptime.c b/src/uptime.c index 8e8f2ca68..27b3d8d08 100644 --- a/src/uptime.c +++ b/src/uptime.c @@ -176,7 +176,7 @@ static void uptime (const char *filename, int options) { size_t n_users; - STRUCT_UTMP *utmp_buf; + STRUCT_UTMP *utmp_buf = NULL; #if HAVE_UTMPX_H || HAVE_UTMP_H if (read_utmp (filename, &n_users, &utmp_buf, options) != 0) @@ -184,6 +184,8 @@ uptime (const char *filename, int options) #endif print_uptime (n_users, utmp_buf); + + IF_LINT (free (utmp_buf)); } void |