Commit 21d4e924 authored by Natanael Copa's avatar Natanael Copa Committed by Timo Teräs

db: fix segfault when --root points to invalid dir

fixes #2134
parent 7086a19f
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment