1
0
mirror of https://github.com/moparisthebest/pacman synced 2025-02-28 17:31:52 -05:00

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 <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Chantry Xavier 2007-11-26 16:54:47 +01:00 committed by Dan McGee
parent 5f811dc020
commit 22c2043160
2 changed files with 4 additions and 5 deletions

View File

@ -575,7 +575,6 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
if(!sync) { if(!sync) {
continue; continue;
} }
found = alpm_depcmp(sync, missdep);
found = alpm_depcmp(sync, missdep) && !_alpm_pkg_find(alpm_pkg_get_name(sync), remove); found = alpm_depcmp(sync, missdep) && !_alpm_pkg_find(alpm_pkg_get_name(sync), remove);
if(!found) { if(!found) {
continue; continue;
@ -594,10 +593,10 @@ int _alpm_resolvedeps(pmdb_t *local, alpm_list_t *dbs_sync, pmpkg_t *syncpkg,
missdepstring, miss->target); missdepstring, miss->target);
free(missdepstring); free(missdepstring);
if(data) { if(data) {
if((miss = malloc(sizeof(pmdepmissing_t))) == NULL) { MALLOC(miss, sizeof(pmdepmissing_t), 0);
_alpm_log(PM_LOG_ERROR, _("malloc failure: could not allocate %zd bytes\n"), sizeof(pmdepmissing_t)); if(!miss) {
FREELIST(*data);
pm_errno = PM_ERR_MEMORY; pm_errno = PM_ERR_MEMORY;
FREELIST(*data);
goto error; goto error;
} }
*miss = *(pmdepmissing_t *)i->data; *miss = *(pmdepmissing_t *)i->data;

View File

@ -670,7 +670,7 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
if(deps) { if(deps) {
pm_errno = PM_ERR_UNSATISFIED_DEPS; pm_errno = PM_ERR_UNSATISFIED_DEPS;
ret = -1; ret = -1;
FREELIST(deps); *data = deps;
goto cleanup; goto cleanup;
} }
} }