summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-01-06 22:58:01 +0000
committerAurelien Foret <aurelien@archlinux.org>2006-01-06 22:58:01 +0000
commitdb8a5e358617038b3e884a13462a4f0163b56cc5 (patch)
tree5645a2e7bdc3d5a404db079689c1bde766a1ce75 /lib/libalpm
parentc2b27b58804b9a33a8dd13f62a192f5154416d0d (diff)
downloadpacman-db8a5e358617038b3e884a13462a4f0163b56cc5.tar.xz
- sync: populates *data when a conflict can't be resolved
- add: code cleanup
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/add.c6
-rw-r--r--lib/libalpm/sync.c16
2 files changed, 20 insertions, 2 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index b7f1aa90..8f3d03ce 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -242,7 +242,11 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data)
if(!errorout) {
errorout = 1;
}
- MALLOC(miss, sizeof(pmdepmissing_t));
+ if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
+ FREELIST(lp);
+ FREELIST(*data);
+ RET_ERR(PM_ERR_MEMORY, -1);
+ }
*miss = *(pmdepmissing_t*)i->data;
*data = pm_list_add(*data, miss);
}
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 7f770f1c..14fbfd4b 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -514,20 +514,34 @@ int sync_prepare(pmtrans_t *trans, pmdb_t *db_local, PMList *dbs_sync, PMList **
/* abort */
_alpm_log(PM_LOG_ERROR, "package conflicts detected");
errorout = 1;
+ if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
+ FREELIST(*data);
+ pm_errno = PM_ERR_MEMORY;
+ goto error;
+ }
+ *miss = *(pmdepmissing_t *)i->data;
+ *data = pm_list_add(*data, miss);
}
}
} else {
_alpm_log(PM_LOG_ERROR, "%s conflicts with %s", miss->target, miss->depend.name);
errorout = 1;
+ if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) {
+ FREELIST(*data);
+ pm_errno = PM_ERR_MEMORY;
+ goto error;
+ }
+ *miss = *(pmdepmissing_t *)i->data;
+ *data = pm_list_add(*data, miss);
}
}
}
}
- FREELIST(deps);
if(errorout) {
pm_errno = PM_ERR_CONFLICTING_DEPS;
goto error;
}
+ FREELIST(deps);
}
EVENT(trans, PM_TRANS_EVT_INTERCONFLICTS_DONE, NULL, NULL);