Bug 7509 - Missing free(3) in error path
Summary: Missing free(3) in error path
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamc/spamd (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: PC OpenBSD
: P2 normal
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-30 07:34 UTC by Giovanni Bechis
Modified: 2018-08-24 01:53 UTC (History)
3 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status
free *opt where needed patch None Giovanni Bechis [HasCLA]
More free(3) call patch None Giovanni Bechis [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Giovanni Bechis 2017-11-30 07:34:16 UTC
Created attachment 5487 [details]
free *opt where needed

In getopt.c, in an error path *opt is never free.
Comment 1 Kevin A. McGrail 2017-11-30 12:47:12 UTC
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.
Comment 2 RW 2017-11-30 13:53:10 UTC
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.
Comment 3 Giovanni Bechis 2017-11-30 18:18:57 UTC
Created attachment 5488 [details]
More free(3) call
Comment 4 RW 2017-11-30 18:51:34 UTC
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.
Comment 5 Kevin A. McGrail 2018-08-24 01:53:51 UTC
Fixing the last missing opt not freed.

Trunk: Committed revision 1838778.
3.4: Committed revision 1838779.