Fix PM_ERR_CONFLICTING_DEPS handling in sync.c
* eliminate asymmetry (innerconflict vs. outerconflict) * fix a memleak (in case of PM_ERR_MEMORY deps wasn't freed) * fix wrong pmconflict_t duplication (*retconflict = *conflict) Note: the new code introduces some code duplication which shall disappear by fixing FS#7524. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
ea828b5693
commit
9bfbd73917
1 changed files with 15 additions and 14 deletions
|
@ -475,9 +475,17 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||||
rsync = sync1;
|
rsync = sync1;
|
||||||
sync = sync2;
|
sync = sync2;
|
||||||
} else {
|
} else {
|
||||||
|
_alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
|
||||||
pm_errno = PM_ERR_CONFLICTING_DEPS;
|
pm_errno = PM_ERR_CONFLICTING_DEPS;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
*data = deps;
|
if(data) {
|
||||||
|
pmconflict_t *newconflict = _alpm_conflict_dup(conflict);
|
||||||
|
if(newconflict) {
|
||||||
|
*data = alpm_list_add(*data, newconflict);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_conflict_free);
|
||||||
|
alpm_list_free(deps);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,21 +550,14 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
||||||
sync->data = alpm_list_add(sync->data, local);
|
sync->data = alpm_list_add(sync->data, local);
|
||||||
} else { /* abort */
|
} else { /* abort */
|
||||||
_alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
|
_alpm_log(PM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
|
||||||
if(data) {
|
|
||||||
pmconflict_t *retconflict;
|
|
||||||
MALLOC(retconflict, sizeof(pmconflict_t), 0);
|
|
||||||
if(!retconflict) {
|
|
||||||
pm_errno = PM_ERR_MEMORY;
|
|
||||||
alpm_list_free_inner(*data, (alpm_list_fn_free)_alpm_conflict_free);
|
|
||||||
alpm_list_free(*data);
|
|
||||||
ret = -1;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
*retconflict = *conflict;
|
|
||||||
*data = alpm_list_add(*data, retconflict);
|
|
||||||
}
|
|
||||||
pm_errno = PM_ERR_CONFLICTING_DEPS;
|
pm_errno = PM_ERR_CONFLICTING_DEPS;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
if(data) {
|
||||||
|
pmconflict_t *newconflict = _alpm_conflict_dup(conflict);
|
||||||
|
if(newconflict) {
|
||||||
|
*data = alpm_list_add(*data, newconflict);
|
||||||
|
}
|
||||||
|
}
|
||||||
alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_conflict_free);
|
alpm_list_free_inner(deps, (alpm_list_fn_free)_alpm_conflict_free);
|
||||||
alpm_list_free(deps);
|
alpm_list_free(deps);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
Loading…
Add table
Reference in a new issue