aboutsummaryrefslogtreecommitdiffstats
path: root/g10/getkey.c
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-10-27 13:31:30 +0000
committerJustus Winter <[email protected]>2016-10-27 13:31:30 +0000
commit8ea72a776a88f3c851e812d258355be80caa1bc1 (patch)
tree303d1065ad27ed2861dc1e025089c6f68e3c0fd2 /g10/getkey.c
parentFix typos. (diff)
downloadgnupg-8ea72a776a88f3c851e812d258355be80caa1bc1.tar.gz
gnupg-8ea72a776a88f3c851e812d258355be80caa1bc1.zip
g10: Fix iteration over getkey results.
* g10/getkey.c (getkey_next): Return the public key in PK even if RET_KEYBLOCK is NULL. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'g10/getkey.c')
-rw-r--r--g10/getkey.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index 325f00bc9..5ef5fc3d4 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -1930,7 +1930,7 @@ getkey_byname (ctrl_t ctrl, getkey_ctx_t *retctx, PKT_public_key *pk,
* If PK is not NULL, the public key of the next result is returned in
* *PK. Note: The self-signed data has already been merged into the
* public key using merge_selfsigs. Free *PK by calling
- * release_public_key_parts (or, if PK was allocated using xfree, you
+ * release_public_key_parts (or, if PK was allocated using xmalloc, you
* can use free_public_key, which calls release_public_key_parts(PK)
* and then xfree(PK)).
*
@@ -1954,8 +1954,11 @@ getkey_next (getkey_ctx_t ctx, PKT_public_key *pk, kbnode_t *ret_keyblock)
keydb_disable_caching (ctx->kr_handle);
rc = lookup (ctx, ret_keyblock, &found_key, ctx->want_secret);
- if (!rc && pk && ret_keyblock)
- pk_from_block (pk, *ret_keyblock, found_key);
+ if (!rc && pk)
+ {
+ log_assert (found_key);
+ pk_from_block (pk, NULL, found_key);
+ }
return rc;
}