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.
Fix applied, this will be in OpenSSH-5.6. Thanks for the nice testcase and patch.
Move resolved bugs to CLOSED after 5.7 release