diff options
author | Timo Teras <timo.teras@iki.fi> | 2009-01-22 21:45:18 +0200 |
---|---|---|
committer | Timo Teras <timo.teras@iki.fi> | 2009-01-22 21:45:18 +0200 |
commit | b8eb27d75b30775d5ad2a46b4f7874107bc5d29b (patch) | |
tree | c61919fc09fc47cb6931fafbd2f94e645744bb05 /src | |
parent | 3bcc676a2b79bbe8c4eaea1e1592c4d839497301 (diff) | |
download | apk-tools-b8eb27d75b30775d5ad2a46b4f7874107bc5d29b.tar.gz apk-tools-b8eb27d75b30775d5ad2a46b4f7874107bc5d29b.tar.bz2 apk-tools-b8eb27d75b30775d5ad2a46b4f7874107bc5d29b.tar.xz apk-tools-b8eb27d75b30775d5ad2a46b4f7874107bc5d29b.zip |
db: fix purging of packages from database
apk_hash_delete() actually deletes the file entry, so unlinking
from other lists need to happen before that. Also free the diri
instead of leaking it.
Diffstat (limited to 'src')
-rw-r--r-- | src/database.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/database.c b/src/database.c index 1ae4778..6a99ea6 100644 --- a/src/database.c +++ b/src/database.c @@ -1120,18 +1120,17 @@ static void apk_db_purge_pkg(struct apk_database *db, .dirname = APK_BLOB_STR(diri->dir->dirname), .filename = APK_BLOB_STR(file->filename), }; - apk_hash_delete(&db->installed.files, - APK_BLOB_BUF(&key)); unlink(name); if (apk_verbosity > 1) printf("%s\n", name); __hlist_del(fc, &diri->owned_files.first); - file->diri = NULL; + apk_hash_delete(&db->installed.files, + APK_BLOB_BUF(&key)); db->installed.stats.files--; } apk_db_diri_rmdir(diri); - apk_db_dir_unref(db, diri->dir); __hlist_del(dc, &pkg->owned_dirs.first); + apk_db_diri_free(db, diri); } apk_pkg_set_state(db, pkg, APK_STATE_NO_INSTALL); } |