Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/db.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/db.c')
-rw-r--r--lib/libalpm/db.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 1052840f..8c36c310 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -582,18 +582,9 @@ pmdb_t *_alpm_db_new(const char *dbpath, const char *treename)
ALPM_LOG_FUNC;
- db = calloc(1, sizeof(pmdb_t));
- if(db == NULL) {
- _alpm_log(PM_LOG_ERROR, "calloc : %s\n", strerror(errno));
- RET_ERR(PM_ERR_MEMORY, NULL);
- }
+ CALLOC(db, 1, sizeof(pmdb_t), RET_ERR(PM_ERR_MEMORY, NULL));
+ CALLOC(db->path, 1, pathsize, RET_ERR(PM_ERR_MEMORY, NULL));
- db->path = calloc(1, pathsize);
- if(db->path == NULL) {
- _alpm_log(PM_LOG_ERROR, "calloc : %s\n", strerror(errno));
- FREE(db);
- RET_ERR(PM_ERR_MEMORY, NULL);
- }
sprintf(db->path, "%s%s/", dbpath, treename);
strncpy(db->treename, treename, PATH_MAX);