1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-27 13:21:11 +03:00

bignum: Make bignum_free safer

Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Aris Adamantiadis
2016-01-01 19:16:49 +01:00
committed by Andreas Schneider
parent c3dac948c9
commit db9da99a36
9 changed files with 51 additions and 41 deletions

View File

@@ -1321,19 +1321,19 @@ static int _bignum_cmp(const gcry_sexp_t s1,
sexp = gcry_sexp_find_token(s2, what, 0);
if (sexp == NULL) {
bignum_free(b1);
bignum_safe_free(b1);
return 1;
}
b2 = gcry_sexp_nth_mpi(sexp, 1, GCRYMPI_FMT_USG);
gcry_sexp_release(sexp);
if (b2 == NULL) {
bignum_free(b1);
bignum_safe_free(b1);
return 1;
}
result = !! bignum_cmp(b1, b2);
bignum_free(b1);
bignum_free(b2);
bignum_safe_free(b1);
bignum_safe_free(b2);
return result;
}