From 13c88a2e0a7a894f23be0a12a5b75876d8e24f21 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Mon, 16 Dec 2019 16:48:40 +0100 Subject: [PATCH] mbedcrypto_missing: Avoid potential memory leaks as reported by csbuild Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider --- src/mbedcrypto_missing.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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);