[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] sort.c: Fix minor memory leak, "files" is never free'd
From: |
Eric Blake |
Subject: |
Re: [PATCH] sort.c: Fix minor memory leak, "files" is never free'd |
Date: |
Tue, 16 Feb 2010 06:05:24 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 |
According to Joey Degges on 2/16/2010 2:02 AM:
> Hello,
>
> At sort.c:3271 'files' is allocated but it is not free'd before main exits:
> files = xnmalloc (argc, sizeof *files);
Thanks for the patches. However, calling free() immediately before exit()
is a lint-like activity - it is actually SLOWER to explicitly free memory
rather than just exiting and letting the OS cleanup reclaim the memory as
part of process death. If we accept patches like this, it will be to make
other leak detections easier, but as such, it should probably be properly
guarded by #if LINT or something similar to make it apparent that it is
only needed when looking for leaks and not in the common case.
--
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
signature.asc
Description: OpenPGP digital signature