g10: Release resources when returning an error in get_seckey.

* g10/getkey.c (get_seckey): If the key doesn't have a secret key,
release *PK.

--
Signed-off-by: Neal H. Walfield <neal@g10code.com>.
This commit is contained in:
Neal H. Walfield 2015-09-16 14:03:50 +02:00
parent cab581c486
commit 1b601de06a
1 changed files with 5 additions and 1 deletions

View File

@ -562,7 +562,11 @@ get_seckey (PKT_public_key *pk, u32 *keyid)
release_kbnode (keyblock);
if (!err)
err = agent_probe_secret_key (/*ctrl*/NULL, pk);
{
err = agent_probe_secret_key (/*ctrl*/NULL, pk);
if (err)
release_public_key_parts (pk);
}
return err;
}