mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
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:
1 parent
c7dd45361c
commit
8d2da3f58a
1 file changed
+3
-1
+3
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user