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>
This commit is contained in:
Dave Reisner 2012-03-14 23:06:24 -04:00 committed by Dan McGee
parent 952ee5e6cb
commit f41037358a
1 changed files with 2 additions and 0 deletions

View File

@ -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++;