[Pkg-gnupg-commit] [gnupg2] 15/102: gpg: Explicitly close a combined Tofu DB.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Jun 17 00:14:49 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit 006a6126131ffd59d9a47889ac031f932ecc5d0b
Author: Werner Koch <wk at gnupg.org>
Date:   Sat May 21 12:49:12 2016 +0200

    gpg: Explicitly close a combined Tofu DB.
    
    * g10/tofu.c (tofu_closedbs): Close combined DB.
---
 g10/tofu.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/g10/tofu.c b/g10/tofu.c
index 314c76b..8c639db 100644
--- a/g10/tofu.c
+++ b/g10/tofu.c
@@ -84,8 +84,8 @@ enum db_type
    theis case, NAME is either the normalized email address or the
    fingerprint.
 
-   To initialize this data structure, call opendbs().  When you are
-   done, clean it up using closedbs().  To get a handle to a database,
+   To initialize this data structure, call opendbs().  Cleanup is done
+   when the CTRL object is released.  To get a handle to a database,
    use the getdb() function.  This will either return an existing
    handle or open a new DB connection, as appropriate.  */
 struct db
@@ -1063,7 +1063,12 @@ tofu_closedbs (ctrl_t ctrl)
   if (!dbs)
     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 *db;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list