mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
pki_gcrypt: Fix memory leak
* src/pki_gcrypt.c (_bignum_cmp): Fix memory leak. 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
ba3ee9f007
commit
fc9434465c
@@ -1064,6 +1064,7 @@ static int _bignum_cmp(const gcry_sexp_t s1,
|
|||||||
gcry_sexp_t sexp;
|
gcry_sexp_t sexp;
|
||||||
bignum b1;
|
bignum b1;
|
||||||
bignum b2;
|
bignum b2;
|
||||||
|
int result;
|
||||||
|
|
||||||
sexp = gcry_sexp_find_token(s1, what, 0);
|
sexp = gcry_sexp_find_token(s1, what, 0);
|
||||||
if (sexp == NULL) {
|
if (sexp == NULL) {
|
||||||
@@ -1077,19 +1078,20 @@ static int _bignum_cmp(const gcry_sexp_t s1,
|
|||||||
|
|
||||||
sexp = gcry_sexp_find_token(s2, what, 0);
|
sexp = gcry_sexp_find_token(s2, what, 0);
|
||||||
if (sexp == NULL) {
|
if (sexp == NULL) {
|
||||||
|
bignum_free(b1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
b2 = gcry_sexp_nth_mpi(sexp, 1, GCRYMPI_FMT_USG);
|
b2 = gcry_sexp_nth_mpi(sexp, 1, GCRYMPI_FMT_USG);
|
||||||
gcry_sexp_release(sexp);
|
gcry_sexp_release(sexp);
|
||||||
if (b2 == NULL) {
|
if (b2 == NULL) {
|
||||||
|
bignum_free(b1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bignum_cmp(b1, b2) != 0) {
|
result = !! bignum_cmp(b1, b2);
|
||||||
return 1;
|
bignum_free(b1);
|
||||||
}
|
bignum_free(b2);
|
||||||
|
return result;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int pki_key_compare(const ssh_key k1,
|
int pki_key_compare(const ssh_key k1,
|
||||||
|
|||||||
Reference in New Issue
Block a user