Bug 1921 - [Patch] memory leak in sftp-client.c
Summary: [Patch] memory leak in sftp-client.c
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp (show other bugs)
Version: -current
Hardware: All All
: P2 trivial
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_6_0
  Show dependency treegraph
 
Reported: 2011-07-31 03:51 AEST by Loganaden Velvindron
Modified: 2015-08-11 23:02 AEST (History)
2 users (show)

See Also:


Attachments
Fix for memory leak in sftp-client.c (1.01 KB, application/octet-stream)
2011-07-31 03:51 AEST, Loganaden Velvindron
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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