Bug 2182

Summary: getopt(3) command-line arguments memleaks
Product: Portable OpenSSH Reporter: Tiago Cunha <tcunha>
Component: MiscellaneousAssignee: Darren Tucker <dtucker>
Status: CLOSED FIXED    
Severity: enhancement CC: dtucker
Priority: P5    
Version: 6.4p1   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 2451    
Attachments:
Description Flags
Plug getopt(3) command-line arguments memleaks
none
Plug getopt(3) command-line arguments memleaks none

Description Tiago Cunha 2013-12-11 01:23:21 AEDT
Created attachment 2386 [details]
Plug getopt(3) command-line arguments memleaks

Some options, when used more than once, are currently leaking memory.
For instance:
    $ ssh -Elog1 -Elog2 -carcfour -caes128-ctr

I've decided to remove the xstrdup call and used a simple assignment to optarg when specifying a log file, instead of freeing it previously, since it's only used once in log_redirect_stderr_to.
Comment 1 Tiago Cunha 2013-12-11 01:27:10 AEDT
I'll just use the Miscellaneous component instead of creating a specific bug to address the same memory leaks in the daemon. Hope that's alright.
Comment 2 Tiago Cunha 2013-12-11 01:28:26 AEDT
Created attachment 2387 [details]
Plug getopt(3) command-line arguments memleaks
Comment 3 Darren Tucker 2015-06-05 14:18:44 AEST
Add to the list for 7.0
Comment 4 Damien Miller 2015-08-11 22:59:11 AEST
Retarget pending bugs to openssh-7.1
Comment 5 Darren Tucker 2015-09-04 18:22:35 AEST
Patch has been applied and will be in 7.2.  Thanks!
Comment 6 Damien Miller 2016-08-02 10:41:29 AEST
Close all resolved bugs after 7.3p1 release