From d97ee793337e3590bed38426a0c46d095b087d48 Mon Sep 17 00:00:00 2001 From: Nuno Goncalves Date: Mon, 6 Jun 2016 18:29:03 +0100 Subject: [PATCH] fix #788 pkcs15-tool --read-ssh-key crash Don't try to free again pubkey if the parent cert has already been freed. Signed-off-by: Nuno Goncalves --- src/tools/pkcs15-tool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/pkcs15-tool.c b/src/tools/pkcs15-tool.c index 5b66320f..5ec63c77 100644 --- a/src/tools/pkcs15-tool.c +++ b/src/tools/pkcs15-tool.c @@ -1051,8 +1051,8 @@ static int read_ssh_key(void) fclose(outf); if (cert) sc_pkcs15_free_certificate(cert); - sc_pkcs15_free_pubkey(pubkey); - + else if (pubkey) + sc_pkcs15_free_pubkey(pubkey); return 0; fail: printf("can't convert key: buffer too small\n");