SA Bugzilla – Bug 7509
Missing free(3) in error path
Last modified: 2018-08-24 01:53:51 UTC
Created attachment 5487 [details] free *opt where needed In getopt.c, in an error path *opt is never free.
Thanks Giovanni. It's very helpful with these patches and your BZ grooming. I look forward to looking at your bigger patches and having you earn committer karma sooner than later. Trunk: Committed revision 1816708. 3.4: Committed revision 1816710.
Is it just the error path? I don't see where it's ever freed. It actually makes no practical difference whether opt is freed or not.
Created attachment 5488 [details] More free(3) call
I don't see the point of this. The author very likely made a decision not to bother freeing these small strings as they can't add up to more than the size of the ARGV variables. On average you are probably wasting more memory on the free() calls than you gain on the heap.
Fixing the last missing opt not freed. Trunk: Committed revision 1838778. 3.4: Committed revision 1838779.