Bug 1921

Summary: [Patch] memory leak in sftp-client.c
Product: Portable OpenSSH Reporter: Loganaden Velvindron <loganaden>
Component: sftpAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: trivial CC: ajay.ramjatan, djm
Priority: P2    
Version: -current   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 1930    
Attachments:
Description Flags
Fix for memory leak in sftp-client.c none

Description Loganaden Velvindron 2011-07-31 03:51:08 AEST
Created attachment 2071 [details]
Fix for memory leak in sftp-client.c

in do_hardlink(), buffer_init(&msg) may be unfreed
if the server does not support hardlink condition is met.

Jonathan Armani (armani@) advises moving it down.

Same thing happens in do_readlink(): if it's unable
to readlink(), the function returns without freeing
msg.

I've attached a patch. This runs on both openbsd -current
& portable openssh -current.

The attached patch concerns portable OpenSSH.

Thanks & Regards,
//Logan
C-x-C-c
Comment 1 Ajay R Ramjatan 2011-07-31 05:42:22 AEST
Patches, compiles and works on Linux x86, gcc 4.5.2

OpenSSH_5.8p2, OpenSSL 1.0.0d 8 Feb 2011
Comment 2 Loganaden Velvindron 2011-07-31 05:50:21 AEST
(In reply to comment #0)
> Created attachment 2071 [details]
> Fix for memory leak in sftp-client.c
> 
> in do_hardlink(), buffer_init(&msg) may be unfreed
> if the server does not support hardlink condition is met.
> 
> Jonathan Armani (armani@) advises moving it down.
> 
> Same thing happens in do_readlink(): if it's unable
> to readlink(), the function returns without freeing
> msg.
> 
> I've attached a patch. This runs on both openbsd -current
> & portable openssh -current.
> 
> The attached patch concerns portable OpenSSH.
> 
> Thanks & Regards,
> //Logan
> C-x-C-c

My mistake. I sent another patch for OpenSSH on openbsd.

http://marc.info/?l=openbsd-tech&m=131131952504707&w=2
Comment 3 Damien Miller 2011-09-22 21:56:55 AEST
Markus applied these, they will be in OpenSSH-6.0
Comment 4 Damien Miller 2015-08-11 23:02:46 AEST
Set all RESOLVED bugs to CLOSED with release of OpenSSH 7.1