gpg: Fix a memory leak in get_best_pubkey_byname.

* g10/getkey.c (get_best_pubkey_byname): Free the public key parts.

--

Cherry-picked from master commit:
	e28572116f

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2019-10-07 10:41:01 +09:00
parent beeab41e47
commit 2924ac374e
1 changed files with 4 additions and 1 deletions

View File

@ -1572,7 +1572,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);
}