From 149ceb3cae03d0385341d32430aa5ae57de90007 Mon Sep 17 00:00:00 2001
From: Werner Koch <wk@gnupg.org>
Date: Wed, 24 Oct 2018 09:50:17 +0200
Subject: [PATCH 096/152] ecc: Fix possible memory leakage in parameter check
 of eddsa.

* cipher/ecc-eddsa.c (_gcry_ecc_eddsa_verify): Fix mem leak.
--

GnuPG-bug-id: 4209
Signed-off-by: Werner Koch <wk@gnupg.org>
---
 cipher/ecc-eddsa.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cipher/ecc-eddsa.c b/cipher/ecc-eddsa.c
index 813e030..89b708a 100644
--- a/cipher/ecc-eddsa.c
+++ b/cipher/ecc-eddsa.c
@@ -760,7 +760,10 @@ _gcry_ecc_eddsa_verify (gcry_mpi_t input, ECC_public_key *pkey,
                                      pkey->E.p, pkey->E.a, pkey->E.b);
   b = ctx->nbits/8;
   if (b != 256/8)
-    return GPG_ERR_INTERNAL; /* We only support 256 bit. */
+    {
+      rc = GPG_ERR_INTERNAL; /* We only support 256 bit. */
+      goto leave;
+    }
 
   /* Decode and check the public key.  */
   rc = _gcry_ecc_eddsa_decodepoint (pk, ctx, &Q, &encpk, &encpklen);
-- 
1.8.3.1

