summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-11-17 09:39:00 -0600
committerDan McGee <dan@archlinux.org>2007-11-17 09:39:00 -0600
commit3d10786394f5b2a65104fdff3d31d70022dfd68d (patch)
treeccd96bd1b034c5255b17e198e3f30b8e038079e8
parentcfcc550e2ac55616c81d2347c2467aec9d56d25e (diff)
downloadpacman-3d10786394f5b2a65104fdff3d31d70022dfd68d.tar.xz
Fix memleak in _alpm_trans_free with package lists
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/trans.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index f740472d..66a9ce33 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -247,6 +247,8 @@ pmtrans_t *_alpm_trans_new()
void _alpm_trans_free(pmtrans_t *trans)
{
+ alpm_list_t *i;
+
ALPM_LOG_FUNC;
if(trans == NULL) {
@@ -255,20 +257,15 @@ void _alpm_trans_free(pmtrans_t *trans)
FREELIST(trans->targets);
if(trans->type == PM_TRANS_TYPE_SYNC) {
- alpm_list_t *i;
for(i = trans->packages; i; i = alpm_list_next(i)) {
_alpm_sync_free(i->data);
- i->data = NULL;
}
- FREELIST(trans->packages);
} else {
- alpm_list_t *tmp;
- for(tmp = trans->packages; tmp; tmp = alpm_list_next(tmp)) {
- _alpm_pkg_free(tmp->data);
- tmp->data = NULL;
+ for(i = trans->packages; i; i = alpm_list_next(i)) {
+ _alpm_pkg_free(i->data);
}
}
- trans->packages = NULL;
+ alpm_list_free(trans->packages);
FREELIST(trans->skip_add);
FREELIST(trans->skip_remove);