summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-11-11 12:59:45 -0600
committerDan McGee <dan@archlinux.org>2007-11-11 12:59:45 -0600
commit53fdae9a1977168767c27a54cf7e4a92394eb6a0 (patch)
treef11439ffcd0aee9de971381089e62bec0eef72a6 /lib
parent8236be9fd8f97ea8cb4999cf775768bdc276e53e (diff)
downloadpacman-53fdae9a1977168767c27a54cf7e4a92394eb6a0.tar.xz
Fix memleak with new alpm_list_reverse usage
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/remove.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index a4c3c15c..c4e44398 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -301,11 +301,12 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
int filenum = alpm_list_count(files);
double percent = 0.0;
+ alpm_list_t *newfiles;
_alpm_log(PM_LOG_DEBUG, "removing %d files\n", filenum);
/* iterate through the list backwards, unlinking files */
- files = alpm_list_reverse(files);
- for(lp = files; lp; lp = alpm_list_next(lp)) {
+ newfiles = alpm_list_reverse(files);
+ for(lp = newfiles; lp; lp = alpm_list_next(lp)) {
unlink_file(info, lp, trans);
/* update progress bar after each file */
@@ -315,6 +316,7 @@ int _alpm_remove_commit(pmtrans_t *trans, pmdb_t *db)
(pkg_count - alpm_list_count(targ) + 1));
position++;
}
+ free(newfiles);
}
/* set progress to 100% after we finish unlinking files */