diff options
author | NIIBE Yutaka <[email protected]> | 2018-09-13 23:11:45 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2018-09-13 23:11:45 +0000 |
commit | 60c880bda5c9b821fd2968cf89c38c37be3c1a7b (patch) | |
tree | 5e36f8919200878c4b0a328752faf71f8652e9a3 /g10/skclist.c | |
parent | g10: Fix memory leak (more). (diff) | |
download | gnupg-60c880bda5c9b821fd2968cf89c38c37be3c1a7b.tar.gz gnupg-60c880bda5c9b821fd2968cf89c38c37be3c1a7b.zip |
g10: Fix another memory leak.
* g10/skclist.c (enum_secret_keys): Use SK_LIST instead of pubkey_t.
--
The use of pubkey_t was wrong. The use is just a list of keys, not
with keyblock. With SK_LIST, release_sk_list releases memory by
free_public_key.
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'g10/skclist.c')
-rw-r--r-- | g10/skclist.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/g10/skclist.c b/g10/skclist.c index 11c57e575..c9c41d0d9 100644 --- a/g10/skclist.c +++ b/g10/skclist.c @@ -337,7 +337,7 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) kbnode_t keyblock; kbnode_t node; getkey_ctx_t ctx; - pubkey_t results; + SK_LIST results; } *c = *context; if (!c) @@ -358,7 +358,7 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) /* Free the context. */ xfree (c->serialno); free_strlist (c->card_list); - pubkeys_free (c->results); + release_sk_list (c->results); release_kbnode (c->keyblock); getkey_end (ctrl, c->ctx); xfree (c); @@ -516,7 +516,7 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) if (c->node->pkt->pkttype == PKT_PUBLIC_KEY || c->node->pkt->pkttype == PKT_PUBLIC_SUBKEY) { - pubkey_t r; + SK_LIST r; /* Skip this candidate if it's already enumerated. */ for (r = c->results; r; r = r->next) @@ -537,7 +537,6 @@ enum_secret_keys (ctrl_t ctrl, void **context, PKT_public_key *sk) } r->pk = sk; - r->keyblock = NULL; r->next = c->results; c->results = r; |