From 590f610d6b79d4bec993e03bebf7d0850b470f6d Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Mon, 20 Feb 2006 20:41:40 +0000 Subject: dropped the MALLOC macro --- lib/libalpm/db.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib/libalpm/db.c') diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index e4987dd6..a81d5406 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -32,6 +32,7 @@ /* pacman */ #include "log.h" #include "util.h" +#include "error.h" #include "group.h" #include "cache.h" #include "db.h" @@ -48,9 +49,15 @@ pmdb_t *_alpm_db_open(char *dbpath, char *treename, int mode) _alpm_log(PM_LOG_DEBUG, "opening database '%s'", treename); - MALLOC(db, sizeof(pmdb_t)); + db = (pmdb_t *)malloc(sizeof(pmdb_t)); + if(db == NULL) { + RET_ERR(PM_ERR_MEMORY, NULL); + } - MALLOC(db->path, strlen(dbpath)+strlen(treename)+2); + db->path = (char *)malloc(strlen(dbpath)+strlen(treename)+2); + if(db->path == NULL) { + RET_ERR(PM_ERR_MEMORY, NULL); + } sprintf(db->path, "%s/%s", dbpath, treename); db->dir = opendir(db->path); -- cgit v1.2.3-70-g09d2