summaryrefslogtreecommitdiffstats
path: root/g10/getkey.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2019-10-07 03:41:01 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2019-10-07 03:41:01 +0200
commite28572116fe4c586ba9d1e8f27389bf3f06e036b (patch)
treea48a143eb9013ed9ca0aaec85209973d60662c40 /g10/getkey.c
parentgpg: Ignore all SHA-1 signatures in 3rd party key signatures. (diff)
downloadgnupg2-e28572116fe4c586ba9d1e8f27389bf3f06e036b.tar.xz
gnupg2-e28572116fe4c586ba9d1e8f27389bf3f06e036b.zip
gpg: Fix a memory leak in get_best_pubkey_byname.
* g10/getkey.c (get_best_pubkey_byname): Free the public key parts. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to '')
-rw-r--r--g10/getkey.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index 57079fa4d..6802026f6 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -1484,7 +1484,10 @@ get_best_pubkey_byname (ctrl_t ctrl, enum get_pubkey_modes mode,
}
if (pk)
- *pk = best.key;
+ {
+ release_public_key_parts (pk);
+ *pk = best.key;
+ }
else
release_public_key_parts (&best.key);
}