bug-coreutils
[Top][All Lists]
Advanced

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

PATCH: memleak in users.c


From: Dennis Smit
Subject: PATCH: memleak in users.c
Date: Wed, 29 Oct 2003 22:12:16 -0500 (EST)

Hello!

This patch is against src/users.c from coreutils-5.0.91

Within users.c in the function:
static void
users (const char *filename)

there is memory allocated within the read_utmp function for
utmp_buf:
  int fail = read_utmp (filename, &n_users, &utmp_buf);

which is never being freed.

This is solved by the following patch:
------------------
--- users.c     2003-10-30 03:11:09.000000000 +0100
+++ usersnew.c  2003-10-30 03:09:36.000000000 +0100
@@ -104,6 +104,8 @@
     error (EXIT_FAILURE, errno, "%s", filename);

   list_entries_users (n_users, utmp_buf);
+
+  free (utmp_buf);
 }

 void
------------------

This is the first time i submitted a patch to coreutils so in
the case i am submitting it not correctly please correct me
so i'll do it better in the future :)

Greetings,
Dennis Smit






reply via email to

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