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.
This commit is contained in:
Anton Ovchinnikov authored and Pádraig Brady committed 2013-07-07 10:45:39 +01:00
1 parent c7dd45361c
commit 8d2da3f58a
1 file changed
+3 -1
+3 -1
View File
@@ -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