aboutsummaryrefslogtreecommitdiffstats
path: root/g10/tofu.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-01-07 18:05:35 +0000
committerWerner Koch <[email protected]>2016-01-07 18:09:16 +0000
commit8a56a38387c10c02ba0790c655dd5c1d08e4a724 (patch)
tree24ce7c5fa3c8fbb1f9fa7f17f9f12fbc327ae48a /g10/tofu.c
parentgpg: Fix warnings about useless assignments. (diff)
downloadgnupg-8a56a38387c10c02ba0790c655dd5c1d08e4a724.tar.gz
gnupg-8a56a38387c10c02ba0790c655dd5c1d08e4a724.zip
gpg: Avoid warnings about possible NULL deref.
* g10/getkey.c (cache_public_key): Protect deref of CE which actually can't happen. * g10/keygen.c (quickgen_set_para): s/sprintf/snprintf/. * g10/tofu.c (end_transaction, rollback_transaction): Allow NULL for DB. * g10/trustdb.c (update_min_ownertrust): Remove useless clearling of ERR. -- Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rw-r--r--g10/tofu.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/g10/tofu.c b/g10/tofu.c
index b7f61e98e..903f076b4 100644
--- a/g10/tofu.c
+++ b/g10/tofu.c
@@ -306,6 +306,9 @@ end_transaction (struct db *db, int only_batch)
int rc;
char *err = NULL;
+ if (!db)
+ return 0; /* Shortcut to allow for easier cleanup code. */
+
if ((! batch_update || only_batch == 2) && db->batch_update)
/* The batch transaction is still in open, but we left batch
mode. */
@@ -353,6 +356,9 @@ rollback_transaction (struct db *db)
int rc;
char *err = NULL;
+ if (!db)
+ return 0; /* Shortcut to allow for easier cleanup code. */
+
if (db->batch_update)
/* Just undo the most recent update; don't revert any progress
made by the batch transaction. */