Hello,
Here's a little patch about some memory leaks found with valgrind, on
sort, tail and uptime.
Best regards,
Charles Longeau
Index: src/sort.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/sort.c,v
retrieving revision 1.335
diff -u -r1.335 sort.c
--- src/sort.c 14 Dec 2005 23:59:23 -0000 1.335
+++ src/sort.c 30 Jan 2006 00:06:12 -0000
@@ -2293,7 +2293,8 @@
gkey.month = gkey.reverse = false;
gkey.skipsblanks = gkey.skipeblanks = false;
- files = xnmalloc (argc, sizeof *files);
+ if (argc > 1)
+ files = xnmalloc (argc-1, sizeof *files);
for (;;)
{
@@ -2599,6 +2600,8 @@
else
sort (files, nfiles, outfile);
+ free(temp_dirs);
+
if (have_read_stdin && fclose (stdin) == EOF)
die (_("close failed"), "-");
Index: src/tail.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/tail.c,v
retrieving revision 1.248
diff -u -r1.248 tail.c
--- src/tail.c 24 Jan 2006 10:32:32 -0000 1.248
+++ src/tail.c 30 Jan 2006 00:06:12 -0000
@@ -1675,6 +1675,8 @@
if (forever)
tail_forever (F, n_files, sleep_interval);
+ free(F);
+
if (have_read_stdin && close (STDIN_FILENO) < 0)
error (EXIT_FAILURE, errno, "-");
exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
Index: src/uptime.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/uptime.c,v
retrieving revision 1.54
diff -u -r1.54 uptime.c
--- src/uptime.c 3 Dec 2005 23:24:46 -0000 1.54
+++ src/uptime.c 30 Jan 2006 00:06:12 -0000
@@ -166,6 +166,7 @@
error (EXIT_FAILURE, errno, "%s", filename);
print_uptime (n_users, utmp_buf);
+ free(utmp_buf);
}
void
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils