Harden the error path in 'ssh_dh_init_common' such that all potential allocations are free'd upon exit.
Signed-off-by: Jon Simons <j...@jonsimons.org> --- src/dh.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dh.c b/src/dh.c index b4b988d9..c40aef5a 100644 --- a/src/dh.c +++ b/src/dh.c @@ -350,6 +350,9 @@ int ssh_dh_init_common(ssh_session session){ break; } if (crypto->x == NULL || crypto->y == NULL || crypto->k == NULL){ + bignum_safe_free(crypto->k); + bignum_safe_free(crypto->y); + bignum_safe_free(crypto->x); ssh_set_error_oom(session); return SSH_ERROR; } else { -- 2.19.1.593.gc670b1f