]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Fix memory leak in ed25519_openssh_createkey
authorTim Kosse <tim.kosse@filezilla-project.org>
Mon, 23 Jan 2017 17:46:42 +0000 (18:46 +0100)
committerSimon Tatham <anakin@pobox.com>
Sat, 28 Jan 2017 14:03:09 +0000 (14:03 +0000)
If q could not be read from the input blob, the allocated ec_key
structure was not freed.

sshecc.c

index 3bb2082b6e4423bc2342429e8e0912912f35b5d0..3ce6c7fe6ae07e19e3b0b35dfdba92398e1cf999 100644 (file)
--- 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);