Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/server.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-08-21 23:29:10 -0400
committerDan McGee <dan@archlinux.org>2007-08-21 23:29:10 -0400
commit515754faacf9dd33b94e6e5a17ca04d27d61f482 (patch)
tree4788e1d46318b1fd21184696683ec779a9ec7ddb /lib/libalpm/server.c
parentd09d114e99c29d1392c546a6553650ecde5138fc (diff)
Various valgrind mem leak fixes
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/server.c')
-rw-r--r--lib/libalpm/server.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/libalpm/server.c b/lib/libalpm/server.c
index a1456a0a..6c74850e 100644
--- a/lib/libalpm/server.c
+++ b/lib/libalpm/server.c
@@ -244,6 +244,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
fclose(localf);
}
/* try the next server */
+ downloadFreeURL(fileurl);
continue;
} else {
_alpm_log(PM_LOG_DEBUG, "connected to %s successfully", fileurl->host);
@@ -261,6 +262,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
if(dlf != NULL) {
fclose(dlf);
}
+ downloadFreeURL(fileurl);
return(1);
}
}
@@ -287,7 +289,8 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
if(dlf != NULL) {
fclose(dlf);
}
- return -1;
+ downloadFreeURL(fileurl);
+ return(-1);
}
}
@@ -302,6 +305,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
fn, downloadLastErrString);
fclose(localf);
fclose(dlf);
+ downloadFreeURL(fileurl);
return(-1);
}
@@ -313,6 +317,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
realfile, strerror(errno));
fclose(localf);
fclose(dlf);
+ downloadFreeURL(fileurl);
return(-1);
}
}
@@ -324,7 +329,7 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
if(handle->dlcb) handle->dlcb(pkgname, dltotal_bytes, ust.size);
}
-
+ downloadFreeURL(fileurl);
fclose(localf);
fclose(dlf);
rename(output, realfile);
@@ -339,7 +344,10 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
char cwd[PATH_MAX];
/* build the full download url */
- snprintf(url, PATH_MAX, "%s://%s%s", fileurl->scheme, fileurl->host, fileurl->doc);
+ snprintf(url, PATH_MAX, "%s://%s%s", fileurl->scheme,
+ fileurl->host, fileurl->doc);
+ /* we don't need this anymore */
+ downloadFreeURL(fileurl);
/* replace all occurrences of %o with fn.part */
strncpy(origCmd, handle->xfercommand, sizeof(origCmd));
@@ -387,12 +395,12 @@ int _alpm_downloadfiles_forreal(alpm_list_t *servers, const char *localpath,
}
chdir(cwd);
}
- downloadFreeURL(fileurl);
}
if(alpm_list_count(complete) == alpm_list_count(files)) {
done = 1;
}
+ alpm_list_free(complete);
}
return(done ? 0 : -1);