bin/67392: Small memory leak in ls
Matthew Emmerton
matt at gsicomp.on.ca
Sun May 30 13:30:26 PDT 2004
>Number: 67392
>Category: bin
>Synopsis: Small memory leak in ls
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun May 30 13:30:25 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator: Matthew Emmerton
>Release: 4.9-STABLE
>Organization:
GSI Computer Service
>Environment:
FreeBSD penelope.gsicomp.on.ca 4.9-STABLE FreeBSD 4.9-STABLE #3: Fri May 7 22:16:53 EDT 2004 root at penelope.gsicomp.on.ca:/usr/obj/usr/src/sys/PENELOPE.20040505.01 i386
>Description:
There is a tiny memory leak in 'ls'.
If the LS_COLWIDTHS environment variable is defined, then a small memory buffer is malloc()'d to build up a temporary string which is then passed to sscanf().
However, this memory buffer is never freed.
>How-To-Repeat:
I haven't been able to find a test case that causes the memory leak to impact the system.
>Fix:
--- bin/ls/ls.c.orig Sun May 30 16:34:54 2004
+++ bin/ls/ls.c Sun May 30 16:35:06 2004
@@ -597,6 +597,7 @@
maxblock = makenines(maxblock);
maxnlink = makenines(maxnlink);
maxsize = makenines(maxsize);
+ free(jinitmax);
}
bcfile = 0;
flags = NULL;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list