summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-05-04 22:52:41 +0200
committerAurelien Foret <aurelien@archlinux.org>2005-05-04 22:52:41 +0200
commit8b48763b5ddec8b803c8d735a474b440ee0aef36 (patch)
tree893de8cd9e81db62b882908010113769a05d7a43
parentf78f195235c4f0f62830b2e93d0367289913cddc (diff)
downloadpacman-8b48763b5ddec8b803c8d735a474b440ee0aef36.tar.gz
pacman-8b48763b5ddec8b803c8d735a474b440ee0aef36.tar.xz
fixed some small memory leaks
-rw-r--r--src/pacman/package.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 2e363c56..dc3fe3e3 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -90,7 +90,6 @@ void dump_pkg_full(PM_PKG *pkg, int level)
for(i = alpm_list_first(alpm_pkg_getinfo(pkg, PM_PKG_BACKUP)); i; i = alpm_list_next(i)) {
struct stat buf;
char path[PATH_MAX];
- char *md5sum;
char *str = strdup(alpm_list_getdata(i));
char *ptr = index(str, '\t');
if(ptr == NULL) {
@@ -101,12 +100,14 @@ void dump_pkg_full(PM_PKG *pkg, int level)
ptr++;
snprintf(path, PATH_MAX-1, "%s%s", root, str);
if(!stat(path, &buf)) {
- md5sum = alpm_get_md5sum(path);
+ char *md5sum = alpm_get_md5sum(path);
if(md5sum == NULL) {
ERR(NL, "error calculating md5sum for %s\n", path);
+ FREE(str);
continue;
}
printf("%sMODIFIED\t%s\n", strcmp(md5sum, ptr) ? "" : "NOT ", path);
+ FREE(md5sum);
} else {
printf("MISSING\t\t%s\n", path);
}