mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 08:18:51 -05:00
memleak fix: ensure we free result of get_destfile()
In the file:// download case, we didn't free the return from get_destfile() after we were done with it. Fix it. (Found with xfercommand001.py) Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
bf86700369
commit
6104f2e1fb
@ -322,13 +322,12 @@ static int download(const char *url, const char *localpath,
|
|||||||
*/
|
*/
|
||||||
const char *sourcefile = url + len;
|
const char *sourcefile = url + len;
|
||||||
const char *filename = get_filename(url);
|
const char *filename = get_filename(url);
|
||||||
const char *destfile = get_destfile(localpath, filename);
|
char *destfile = get_destfile(localpath, filename);
|
||||||
|
|
||||||
if(_alpm_copyfile(sourcefile, destfile) == 0) {
|
ret = _alpm_copyfile(sourcefile, destfile);
|
||||||
return(0);
|
FREE(destfile);
|
||||||
} else {
|
/* copyfile returns 1 on failure, we want to return -1 on failure */
|
||||||
return(-1);
|
return(ret ? -1 : 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(handle->xfercommand == NULL) {
|
if(handle->xfercommand == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user