From 0d00f7095f1f26b981747c678551436e2495c68e Mon Sep 17 00:00:00 2001 From: Nagy Gabor Date: Fri, 20 Jul 2007 10:43:55 +0200 Subject: libalpm/sync.c : two memleak fixes in _alpm_sync_prepare. Signed-off-by: Chantry Xavier --- lib/libalpm/sync.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 7e83120e..005123d4 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -433,13 +433,8 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync } /* re-order w.r.t. dependencies */ - alpm_list_t *sortlist = NULL; + alpm_list_t *sortlist = _alpm_sortbydeps(list, PM_TRANS_TYPE_ADD); alpm_list_t *newpkgs = NULL; - for(i = trans->packages; i; i = i->next) { - pmsyncpkg_t *s = i->data; - sortlist = alpm_list_add(sortlist, s->pkg); - } - sortlist = _alpm_sortbydeps(sortlist, PM_TRANS_TYPE_ADD); for(i = sortlist; i; i = i->next) { for(j = trans->packages; j; j = j->next) { pmsyncpkg_t *s = j->data; @@ -459,13 +454,13 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync if(deps) { if(data) { *data = deps; - deps = NULL; + } else { + FREELIST(deps); } pm_errno = PM_ERR_UNSATISFIED_DEPS; ret = -1; goto cleanup; } - } /* We don't care about conflicts if we're just printing uris */ -- cgit v1.2.3-24-g4f1b