mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-09 13:07:58 -05:00
Fix a memleak in _alpm_sync_free.
An alpm_list_free call was missing. Also make use of alpm_list_free_inner in both _alpm_sync_free and _alpm_trans_free. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
f5d2150e9d
commit
8bee526d28
@ -74,11 +74,8 @@ void _alpm_sync_free(pmsyncpkg_t *sync)
|
|||||||
|
|
||||||
/* TODO wow this is ugly */
|
/* TODO wow this is ugly */
|
||||||
if(sync->type == PM_SYNC_TYPE_REPLACE) {
|
if(sync->type == PM_SYNC_TYPE_REPLACE) {
|
||||||
alpm_list_t *tmp;
|
alpm_list_free_inner(sync->data, (alpm_list_fn_free)_alpm_pkg_free);
|
||||||
for(tmp = sync->data; tmp; tmp = alpm_list_next(tmp)) {
|
alpm_list_free(sync->data);
|
||||||
_alpm_pkg_free(tmp->data);
|
|
||||||
tmp->data = NULL;
|
|
||||||
}
|
|
||||||
sync->data = NULL;
|
sync->data = NULL;
|
||||||
} else {
|
} else {
|
||||||
_alpm_pkg_free(sync->data);
|
_alpm_pkg_free(sync->data);
|
||||||
|
@ -246,8 +246,6 @@ 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) {
|
||||||
@ -256,13 +254,9 @@ 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) {
|
||||||
for(i = trans->packages; i; i = alpm_list_next(i)) {
|
alpm_list_free_inner(trans->packages, (alpm_list_fn_free)_alpm_sync_free);
|
||||||
_alpm_sync_free(i->data);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
for(i = trans->packages; i; i = alpm_list_next(i)) {
|
alpm_list_free_inner(trans->packages, (alpm_list_fn_free)_alpm_pkg_free);
|
||||||
_alpm_pkg_free(i->data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
alpm_list_free(trans->packages);
|
alpm_list_free(trans->packages);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user