aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-11-09 16:34:14 +0100
committerAndreas Schneider <asn@cryptomilk.org>2016-11-09 18:20:19 +0100
commit4b33c6bb977b9e7b8f0460f8d70d17bc9bd74434 (patch)
tree8d7f4f4253daf0f4cd3c14b6e2db8f4fc542a07e /src
parent2f6a8663731668649499142460f648c687c0f5d3 (diff)
downloadlibssh-4b33c6bb977b9e7b8f0460f8d70d17bc9bd74434.tar.gz
libssh-4b33c6bb977b9e7b8f0460f8d70d17bc9bd74434.tar.xz
libssh-4b33c6bb977b9e7b8f0460f8d70d17bc9bd74434.zip
pki_gcrypt: Fix memory leak.
* src/pki_gcrypt.c (pki_key_ecdsa_to_nid): Release 'sexp'. Signed-off-by: Justus Winter <justus@g10code.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r--src/pki_gcrypt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pki_gcrypt.c b/src/pki_gcrypt.c
index e3ae06d5..025ff1b9 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;
}