summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-03-15 04:06:24 +0100
committerDan McGee <dan@archlinux.org>2012-03-15 04:44:49 +0100
commitf41037358af167424403d30a3b972b1fd733c755 (patch)
treedcbb6419cb59dffbe8ab5c9b3436668d2d45e94a /lib/libalpm/sync.c
parent952ee5e6cb8bb1849c1bceedae38744935c82fca (diff)
downloadpacman-f41037358af167424403d30a3b972b1fd733c755.tar.gz
pacman-f41037358af167424403d30a3b972b1fd733c755.tar.xz
lib/sync: avoid unwanted unlink after download fail
In case we have a mirror failure, unlink_on_fail would remain set, causing an interrupt in a successive download attempt to be wrongly unlinked. This also fixes a memory leak in the url member, as we would allocate over the previous, unfreed URL. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 185878aa..05959ca8 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -896,6 +896,8 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
if(ret != -1) {
break;
}
+ free(payload->fileurl);
+ payload->unlink_on_fail = 0;
}
if(ret == -1) {
errors++;