1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-13 09:07:33 -05:00

Fix major memory leak in sftp_cmd_ls (thanks to Hans-Juergen Petrich

for pointing it out).

[originally from svn r1612]
This commit is contained in:
Simon Tatham
2002-03-31 16:26:13 +00:00
parent 01ca464ad2
commit ae2599845c
3 changed files with 41 additions and 8 deletions

25
sftp.c
View File

@ -923,3 +923,28 @@ void fxp_free_names(struct fxp_names *names)
sfree(names->names);
sfree(names);
}
/*
* Duplicate an fxp_name structure.
*/
struct fxp_name *fxp_dup_name(struct fxp_name *name)
{
struct fxp_name *ret;
ret = smalloc(sizeof(struct fxp_name));
ret->filename = dupstr(name->filename);
ret->longname = dupstr(name->longname);
ret->attrs = name->attrs; /* structure copy */
return ret;
}
/*
* Free up an fxp_name structure.
*/
void fxp_free_name(struct fxp_name *name)
{
int i;
sfree(name->filename);
sfree(name->longname);
sfree(name);
}