summaryrefslogtreecommitdiff
path: root/lib/libalpm/db.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-02-20 20:41:40 +0000
committerAurelien Foret <aurelien@archlinux.org>2006-02-20 20:41:40 +0000
commit590f610d6b79d4bec993e03bebf7d0850b470f6d (patch)
tree8bfa451105a1995c04d19b1cba4a389bfd6fab52 /lib/libalpm/db.c
parenta5f67ef81983fdddc50851a82ecd664efab115d1 (diff)
downloadpacman-590f610d6b79d4bec993e03bebf7d0850b470f6d.tar.xz
dropped the MALLOC macro
Diffstat (limited to 'lib/libalpm/db.c')
-rw-r--r--lib/libalpm/db.c11
1 files changed, 9 insertions, 2 deletions
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);