aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2019-12-16 16:48:40 +0100
committerAndreas Schneider <asn@cryptomilk.org>2020-01-23 09:49:19 +0100
commit46105f4aa6c69da02f96c6913ee08b9b31b9d4cc (patch)
tree931b250227b13f89cc85e478de2d403e23f32828
parent62f7004d5a349c90a4eed658bb56eaa40857865b (diff)
downloadlibssh-46105f4aa6c69da02f96c6913ee08b9b31b9d4cc.tar.gz
libssh-46105f4aa6c69da02f96c6913ee08b9b31b9d4cc.tar.xz
libssh-46105f4aa6c69da02f96c6913ee08b9b31b9d4cc.zip
mbedcrypto_missing: Avoid potential memory leaks as reported by csbuild
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org> (cherry picked from commit 13c88a2e0a7a894f23be0a12a5b75876d8e24f21)
-rw-r--r--src/mbedcrypto_missing.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mbedcrypto_missing.c b/src/mbedcrypto_missing.c
index 5e9da6c5..cf789b13 100644
--- a/src/mbedcrypto_missing.c
+++ b/src/mbedcrypto_missing.c
@@ -149,7 +149,8 @@ int ssh_mbedcry_rand_range(bignum dest, bignum max)
return 0;
}
rc = bignum_rand(rnd, bits);
- if (rc != 1){
+ if (rc != 1) {
+ bignum_safe_free(rnd);
return rc;
}
mbedtls_mpi_mod_mpi(dest, rnd, max);