[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] pki_gcrypt: Fix memory leak.


* src/pki_gcrypt.c (pki_key_ecdsa_to_nid): Release 'sexp'.

Signed-off-by: Justus Winter <justus@xxxxxxxxxxx>
---
 src/pki_gcrypt.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/pki_gcrypt.c b/src/pki_gcrypt.c
index e3ae06d..025ff1b 100644
--- a/src/pki_gcrypt.c
+++ b/src/pki_gcrypt.c
@@ -701,20 +701,24 @@ static int pki_key_ecdsa_to_nid(gcry_sexp_t k)
 
         cmp = memcmp("NIST P-256", tmp, size);
         if (cmp == 0) {
+            gcry_sexp_release(sexp);
             return NID_gcrypt_nistp256;
         }
 
         cmp = memcmp("NIST P-384", tmp, size);
         if (cmp == 0) {
+            gcry_sexp_release(sexp);
             return NID_gcrypt_nistp384;
         }
 
         cmp = memcmp("NIST P-521", tmp, size);
         if (cmp == 0) {
+            gcry_sexp_release(sexp);
             return NID_gcrypt_nistp521;
         }
     }
 
+    gcry_sexp_release(sexp);
     return -1;
 }
 
-- 
2.10.2


Follow-Ups:
[PATCH 2/2] pki_gcrypt: Fix freeing of ECDSA signatures.Justus Winter <justus@xxxxxxxxxxx>
Re: [PATCH 1/2] pki_gcrypt: Fix memory leak.Andreas Schneider <asn@xxxxxxxxxxxxxx>
References:
Re: Build libssh against gcryptAndreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org