Alexander V. Lukyanov
Mon, 19 Apr 2004 01:47:17 -0700
On Sun, Apr 18, 2004 at 12:19:45PM +0200, Stein M. Hugubakken wrote: > It seems lftp is gobbling up my memory when I use sftp and mirror -R,
Please try attached patch. It fixes the memory leak in storing and renaming files via sftp protocol. -- Alexander.
Index: SFtp.h
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/SFtp.h,v
retrieving revision 1.13
diff -u -p -r1.13 SFtp.h
--- SFtp.h 5 Apr 2004 14:04:14 -0000 1.13
+++ SFtp.h 19 Apr 2004 07:59:12 -0000
@@ -550,6 +550,7 @@ private:
char *data;
Request_WRITE(const char *h,int hlen,off_t p,const char *d,unsigned l)
: PacketSTRING(SSH_FXP_WRITE,h,hlen) { pos=p; len=l; data=(char*)xmemdup(d,l);
}
+ ~Request_WRITE() { xfree(data); }
void ComputeLength() { PacketSTRING::ComputeLength(); length+=8+4+len; }
void Pack(Buffer *b);
};
@@ -584,6 +585,11 @@ private:
{
oldpath=xstrdup(o);
newpath=xstrdup(n);
+ }
+ ~Request_RENAME()
+ {
+ xfree(oldpath);
+ xfree(newpath);
}
void ComputeLength()
{