gpg: Fix a memory leak in get_best_pubkey_byname.
authorNIIBE Yutaka <gniibe@fsij.org>
Mon, 7 Oct 2019 01:41:01 +0000 (10:41 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Mon, 7 Oct 2019 01:41:01 +0000 (10:41 +0900)
* g10/getkey.c (get_best_pubkey_byname): Free the public key parts.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
g10/getkey.c

index 57079fa..6802026 100644 (file)
@@ -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);
         }