From 0b4ab2c0a80e8581e2caa50e809af7f5573c0e48 Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Wed, 1 Mar 2006 07:51:00 +0000 Subject: added ERROR logs in case of malloc failures (patch from VMiklos ) --- lib/libalpm/deps.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/libalpm/deps.c') diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 0a9838c3..08e15d38 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -44,7 +44,8 @@ pmdepmissing_t *_alpm_depmiss_new(const char *target, unsigned char type, unsign miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t)); if(miss == NULL) { - return(NULL); + _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes", sizeof(pmdepmissing_t)); + RET_ERR(PM_ERR_MEMORY, NULL); } STRNCPY(miss->target, target, PKG_NAME_LEN); @@ -566,6 +567,7 @@ int _alpm_resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList miss->target, miss->depend.name); if(data) { if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) { + _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes", sizeof(pmdepmissing_t)); FREELIST(*data); pm_errno = PM_ERR_MEMORY; goto error; @@ -605,6 +607,7 @@ int _alpm_resolvedeps(pmdb_t *local, PMList *dbs_sync, pmpkg_t *syncpkg, PMList _alpm_log(PM_LOG_ERROR, "cannot resolve dependencies for \"%s\"", miss->target); if(data) { if((miss = (pmdepmissing_t *)malloc(sizeof(pmdepmissing_t))) == NULL) { + _alpm_log(PM_LOG_ERROR, "malloc failure: could not allocate %d bytes", sizeof(pmdepmissing_t)); FREELIST(*data); pm_errno = PM_ERR_MEMORY; goto error; -- cgit v1.2.3