summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/database.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/database.c b/src/database.c
index 33f7af8..d8b84b5 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1740,7 +1740,9 @@ void apk_db_close(struct apk_database *db)
struct hlist_node *dc, *dn;
int i;
- apk_id_cache_free(&db->id_cache);
+ /* the id cache was never initialized if root_fd failed */
+ if (db->root_fd >= 0)
+ apk_id_cache_free(&db->id_cache);
/* Cleaning up the directory tree will cause mode, uid and gid
* of all modified (package providing that directory got removed)