summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_local.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/be_local.c')
-rw-r--r--lib/libalpm/be_local.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index c5b24982..58582705 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -393,6 +393,10 @@ static int local_db_populate(pmdb_t *db)
/* initialize hash at 50% full */
db->pkgcache = _alpm_pkghash_create(est_count * 2);
+ if(db->pkgcache == NULL){
+ closedir(dbdir);
+ RET_ERR(PM_ERR_MEMORY, -1);
+ }
while((ent = readdir(dbdir)) != NULL) {
const char *name = ent->d_name;