mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
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>
This commit is contained in:
committed by
Andreas Schneider
parent
2f6a866373
commit
4b33c6bb97
@@ -701,20 +701,24 @@ static int pki_key_ecdsa_to_nid(gcry_sexp_t k)
|
|||||||
|
|
||||||
cmp = memcmp("NIST P-256", tmp, size);
|
cmp = memcmp("NIST P-256", tmp, size);
|
||||||
if (cmp == 0) {
|
if (cmp == 0) {
|
||||||
|
gcry_sexp_release(sexp);
|
||||||
return NID_gcrypt_nistp256;
|
return NID_gcrypt_nistp256;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp = memcmp("NIST P-384", tmp, size);
|
cmp = memcmp("NIST P-384", tmp, size);
|
||||||
if (cmp == 0) {
|
if (cmp == 0) {
|
||||||
|
gcry_sexp_release(sexp);
|
||||||
return NID_gcrypt_nistp384;
|
return NID_gcrypt_nistp384;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmp = memcmp("NIST P-521", tmp, size);
|
cmp = memcmp("NIST P-521", tmp, size);
|
||||||
if (cmp == 0) {
|
if (cmp == 0) {
|
||||||
|
gcry_sexp_release(sexp);
|
||||||
return NID_gcrypt_nistp521;
|
return NID_gcrypt_nistp521;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gcry_sexp_release(sexp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user