Bug 1771 - sftp heap memory leak
Summary: sftp heap memory leak
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: sftp (show other bugs)
Version: 5.5p1
Hardware: All All
: P2 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks: V_5_6
  Show dependency treegraph
 
Reported: 2010-05-15 00:53 AEST by Anicka Bernathova
Modified: 2011-01-24 12:33 AEDT (History)
1 user (show)

See Also:


Attachments
fix for sftp memory leak (459 bytes, patch)
2010-05-15 00:53 AEST, Anicka Bernathova
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anicka Bernathova 2010-05-15 00:53:31 AEST
Created attachment 1849 [details]
fix for sftp memory leak

sftp client has a memory leak, steps to reproduce:
1. echo "" | awk '{for(i=0; i <1000000;i++) print "-cd an_not_exist_directory"}' > sftp.cmd (run on server)
2. sftp -b sftp.cmd root@server (run on client)
3. watch heap growing (ie. "pmap pid | grep heap" on Linux):

555555668000 441368K 441368K 441368K rw-p [heap]
555555668000 468480K 468464K 468464K rw-p [heap]
555555668000 486600K 486484K 486484K rw-p [heap]
555555668000 657764K 657764K 657764K rw-p [heap]
555555668000 699912K 699912K 699912K rw-p [heap]
555555668000 751312K 751260K 751260K rw-p [heap]
555555668000 788448K 788448K 788448K rw-p [heap]
555555668000 838304K 838188K 838188K rw-p [heap]
555555668000 916176K 916176K 916176K rw-p [heap]
555555668000 946888K 946876K 946876K rw-p [heap]
555555668000 972972K 972960K 972960K rw-p [heap]
555555668000 995076K 995076K 995076K rw-p [heap]
555555668000 1021032K 1020940K 1020940K rw-p [heap]
555555668000 1044804K 1044804K 1044804K rw-p [heap]
555555668000 1337784K 1337784K 1337784K rw-p [heap]
555555668000 1389828K 1389828K 1389828K rw-p [heap]

I am attaching patch that fixes the problem.
Comment 1 Damien Miller 2010-06-18 14:43:37 AEST
Fix applied, this will be in OpenSSH-5.6. Thanks for the nice testcase and patch.
Comment 2 Damien Miller 2011-01-24 12:33:38 AEDT
Move resolved bugs to CLOSED after 5.7 release