From e882b49051ad731686a97f7317289ef4229ec76a Mon Sep 17 00:00:00 2001 From: Tim Kosse Date: Mon, 23 Jan 2017 18:46:42 +0100 Subject: [PATCH] Fix memory leak in ed25519_openssh_createkey If q could not be read from the input blob, the allocated ec_key structure was not freed. --- sshecc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sshecc.c b/sshecc.c index 3bb2082b..3ce6c7fe 100644 --- a/sshecc.c +++ b/sshecc.c @@ -2029,10 +2029,10 @@ static void *ed25519_openssh_createkey(const struct ssh_signkey *self, } getstring((const char**)blob, len, &q, &qlen); - if (!q) - return NULL; - if (qlen != 64) + if (!q || qlen != 64) { + ecdsa_freekey(ec); return NULL; + } ec->privateKey = bignum_from_bytes_le((const unsigned char *)q, 32);