summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/dload.c5
-rw-r--r--lib/libalpm/sync.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 05988065..b3ac024c 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -390,6 +390,11 @@ static int curl_download_internal(struct dload_payload *payload,
CURL *curl = get_libcurl_handle(handle);
handle->pm_errno = 0;
+ /* make sure these are NULL */
+ FREE(payload->tempfile_name);
+ FREE(payload->destfile_name);
+ FREE(payload->content_disp_name);
+
payload->tempfile_openmode = "wb";
if(!payload->remote_name) {
STRDUP(payload->remote_name, get_filename(payload->fileurl),
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index e84679a0..ab7fe319 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -864,6 +864,9 @@ static int download_single_file(alpm_handle_t *handle, struct dload_payload *pay
{
const alpm_list_t *server;
+ payload->handle = handle;
+ payload->allow_resume = 1;
+
for(server = payload->servers; server; server = server->next) {
const char *server_url = server->data;
size_t len;
@@ -872,12 +875,13 @@ static int download_single_file(alpm_handle_t *handle, struct dload_payload *pay
len = strlen(server_url) + strlen(payload->remote_name) + 2;
MALLOC(payload->fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
snprintf(payload->fileurl, len, "%s/%s", server_url, payload->remote_name);
- payload->handle = handle;
- payload->allow_resume = 1;
if(_alpm_download(payload, cachedir, NULL) != -1) {
return 0;
}
+
+ free(payload->fileurl);
+ payload->unlink_on_fail = 0;
}
return -1;