allow freeing partial db package cache
The free function was checking DB_STATUS_PKGCACHE, which is only set once the package cache has been fully built. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
This commit is contained in:
parent
56f1eeef4b
commit
5c75a55c7d
1 changed files with 5 additions and 6 deletions
|
@ -563,18 +563,17 @@ static void free_groupcache(alpm_db_t *db)
|
||||||
|
|
||||||
void _alpm_db_free_pkgcache(alpm_db_t *db)
|
void _alpm_db_free_pkgcache(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
if(db == NULL || !(db->status & DB_STATUS_PKGCACHE)) {
|
if(db == NULL || db->pkgcache == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_alpm_log(db->handle, ALPM_LOG_DEBUG,
|
_alpm_log(db->handle, ALPM_LOG_DEBUG,
|
||||||
"freeing package cache for repository '%s'\n", db->treename);
|
"freeing package cache for repository '%s'\n", db->treename);
|
||||||
|
|
||||||
if(db->pkgcache) {
|
alpm_list_free_inner(db->pkgcache->list,
|
||||||
alpm_list_free_inner(db->pkgcache->list,
|
(alpm_list_fn_free)_alpm_pkg_free);
|
||||||
(alpm_list_fn_free)_alpm_pkg_free);
|
_alpm_pkghash_free(db->pkgcache);
|
||||||
_alpm_pkghash_free(db->pkgcache);
|
db->pkgcache = NULL;
|
||||||
}
|
|
||||||
db->status &= ~DB_STATUS_PKGCACHE;
|
db->status &= ~DB_STATUS_PKGCACHE;
|
||||||
|
|
||||||
free_groupcache(db);
|
free_groupcache(db);
|
||||||
|
|
Loading…
Add table
Reference in a new issue