aboutsummaryrefslogtreecommitdiffstats
path: root/g10/getkey.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/getkey.c')
-rw-r--r--g10/getkey.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index 37a5b565c..1df7287ba 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -3059,6 +3059,9 @@ lookup (getkey_ctx_t ctx, kbnode_t *ret_keyblock, kbnode_t *ret_found_key,
KBNODE keyblock = NULL;
KBNODE found_key = NULL;
+ if (ret_keyblock)
+ *ret_keyblock = NULL;
+
for (;;)
{
rc = keydb_search (ctx->kr_handle, ctx->items, ctx->nitems, NULL);
@@ -3113,7 +3116,8 @@ found:
if (!rc)
{
- *ret_keyblock = keyblock; /* Return the keyblock. */
+ if (ret_keyblock)
+ *ret_keyblock = keyblock; /* Return the keyblock. */
keyblock = NULL;
}
else if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND && no_suitable_key)