1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-05-24 16:43:28 +02:00

gpg: Explicitly close a combined Tofu DB.

* g10/tofu.c (tofu_closedbs): Close combined DB.
This commit is contained in:
Werner Koch 2016-05-21 12:49:12 +02:00
parent 8abd1f53fd
commit 006a612613
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -84,8 +84,8 @@ enum db_type
theis case, NAME is either the normalized email address or the theis case, NAME is either the normalized email address or the
fingerprint. fingerprint.
To initialize this data structure, call opendbs(). When you are To initialize this data structure, call opendbs(). Cleanup is done
done, clean it up using closedbs(). To get a handle to a database, when the CTRL object is released. To get a handle to a database,
use the getdb() function. This will either return an existing use the getdb() function. This will either return an existing
handle or open a new DB connection, as appropriate. */ handle or open a new DB connection, as appropriate. */
struct db struct db
@ -1063,7 +1063,12 @@ tofu_closedbs (ctrl_t ctrl)
if (!dbs) if (!dbs)
return; /* Not initialized. */ return; /* Not initialized. */
if (dbs->db) if (dbs->db && dbs->db->type == DB_COMBINED)
{
log_assert (!dbs->db->next);
closedb (dbs->db);
}
else if (dbs->db)
{ {
struct db *old_head = db_cache; struct db *old_head = db_cache;
struct db *db; struct db *db;