From 22c2043160f30a9ed34fd2886edaf521029a9248 Mon Sep 17 00:00:00 2001 From: Chantry Xavier Date: Mon, 26 Nov 2007 16:54:47 +0100 Subject: Minor fixes in sync.c and deps.c. * memleak found by Nagy in checkdeps * an useless line found by Nagy in resolvedeps * data wasn't set to the missing dependencies in sync_prepare * use the MALLOC macro in resolvedeps Signed-off-by: Chantry Xavier Signed-off-by: Dan McGee --- lib/libalpm/deps.c | 7 +++---- lib/libalpm/sync.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 6a699bc2..350df6b8 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -575,7 +575,6 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, if(!sync) { continue; } - found = alpm_depcmp(sync, missdep); found = alpm_depcmp(sync, missdep) && !_alpm_pkg_find(alpm_pkg_get_name(sync), remove); if(!found) { continue; @@ -594,10 +593,10 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg, missdepstring, miss->target); free(missdepstring); if(data) { - if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) { - _alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t)); - FREELIST(*data); + MALLOC(miss, sizeof(pmdepmissing_t), 0); + if(!miss) { pm_errno = PM_ERR_MEMORY; + FREELIST(*data); goto error; } *miss = *(pmdepmissing_t *)i->data; diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index f6fa3185..5e58400f 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -670,7 +670,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync if(deps) { pm_errno = PM_ERR_UNSATISFIED_DEPS; ret = -1; - FREELIST(deps); + *data = deps; goto cleanup; } } -- cgit v1.2.3-54-g00ecf