Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-03-23 15:35:22 -0500
committerDan McGee <dan@archlinux.org>2008-03-23 16:57:14 -0500
commit6104f2e1fb872c32d3e6ed1823729592fc6245b9 (patch)
tree7b4116ac09744307a6f18fc5ee6ac18295a52edf
parentbf8670036907b3ede18d37b7a3f0f7e14542a5ac (diff)
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>
-rw-r--r--lib/libalpm/dload.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 2e50544b..2fcf6aa1 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -322,13 +322,12 @@ static int download(const char *url, const char *localpath,
*/
const char *sourcefile = url + len;
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) {
- return(0);
- } else {
- return(-1);
- }
+ ret = _alpm_copyfile(sourcefile, destfile);
+ FREE(destfile);
+ /* copyfile returns 1 on failure, we want to return -1 on failure */
+ return(ret ? -1 : 0);
}
if(handle->xfercommand == NULL) {