index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Aurelien Foret <aurelien@archlinux.org> | 2006-01-07 18:25:28 +0000 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2006-01-07 18:25:28 +0000 |
commit | e405204915600340180cef61471471929fb0c275 (patch) | |
tree | 1f9aa6460524b97772b95c8b50db358eaa665f27 /lib/libalpm/add.c | |
parent | fce68beaafade3453b89ade29d95e99ac172de01 (diff) |
-rw-r--r-- | lib/libalpm/add.c | 37 |
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 8f3d03ce..d683877d 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -196,9 +196,10 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data) ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); ASSERT(db != NULL, RET_ERR(PM_ERR_DB_NULL, -1)); - ASSERT(data != NULL, RET_ERR(PM_ERR_WRONG_ARGS, -1)); - *data = NULL; + if(data) { + *data = NULL; + } /* Check dependencies */ @@ -220,13 +221,15 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data) if(!errorout) { errorout = 1; } - if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) { - FREELIST(lp); - FREELIST(*data); - RET_ERR(PM_ERR_MEMORY, -1); + if(data) { + 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); } - *miss = *(pmdepmissing_t*)i->data; - *data = pm_list_add(*data, miss); } } if(errorout) { @@ -242,13 +245,15 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data) if(!errorout) { errorout = 1; } - if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) { - FREELIST(lp); - FREELIST(*data); - RET_ERR(PM_ERR_MEMORY, -1); + if(data) { + 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); } - *miss = *(pmdepmissing_t*)i->data; - *data = pm_list_add(*data, miss); } } FREELIST(lp); @@ -277,7 +282,9 @@ int add_prepare(pmtrans_t *trans, pmdb_t *db, PMList **data) _alpm_log(PM_LOG_FLOW1, "looking for file conflicts"); lp = db_find_conflicts(db, trans->packages, handle->root, &skiplist); if(lp != NULL) { - *data = lp; + if(data) { + *data = lp; + } FREELIST(skiplist); RET_ERR(PM_ERR_FILE_CONFLICTS, -1); } |