mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-14 05:15:11 -05:00
Fix memleak in _alpm_trans_free with package lists
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
cfcc550e2a
commit
3d10786394
@ -247,6 +247,8 @@ pmtrans_t *_alpm_trans_new()
|
|||||||
|
|
||||||
void _alpm_trans_free(pmtrans_t *trans)
|
void _alpm_trans_free(pmtrans_t *trans)
|
||||||
{
|
{
|
||||||
|
alpm_list_t *i;
|
||||||
|
|
||||||
ALPM_LOG_FUNC;
|
ALPM_LOG_FUNC;
|
||||||
|
|
||||||
if(trans == NULL) {
|
if(trans == NULL) {
|
||||||
@ -255,20 +257,15 @@ void _alpm_trans_free(pmtrans_t *trans)
|
|||||||
|
|
||||||
FREELIST(trans->targets);
|
FREELIST(trans->targets);
|
||||||
if(trans->type == PM_TRANS_TYPE_SYNC) {
|
if(trans->type == PM_TRANS_TYPE_SYNC) {
|
||||||
alpm_list_t *i;
|
|
||||||
for(i = trans->packages; i; i = alpm_list_next(i)) {
|
for(i = trans->packages; i; i = alpm_list_next(i)) {
|
||||||
_alpm_sync_free(i->data);
|
_alpm_sync_free(i->data);
|
||||||
i->data = NULL;
|
|
||||||
}
|
}
|
||||||
FREELIST(trans->packages);
|
|
||||||
} else {
|
} else {
|
||||||
alpm_list_t *tmp;
|
for(i = trans->packages; i; i = alpm_list_next(i)) {
|
||||||
for(tmp = trans->packages; tmp; tmp = alpm_list_next(tmp)) {
|
_alpm_pkg_free(i->data);
|
||||||
_alpm_pkg_free(tmp->data);
|
|
||||||
tmp->data = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trans->packages = NULL;
|
alpm_list_free(trans->packages);
|
||||||
|
|
||||||
FREELIST(trans->skip_add);
|
FREELIST(trans->skip_add);
|
||||||
FREELIST(trans->skip_remove);
|
FREELIST(trans->skip_remove);
|
||||||
|
Loading…
Reference in New Issue
Block a user