From f41037358af167424403d30a3b972b1fd733c755 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Wed, 14 Mar 2012 23:06:24 -0400 Subject: 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 --- lib/libalpm/sync.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') 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++; -- cgit v1.2.3-70-g09d2