diff options
author | Jon Simons <jon@jonsimons.org> | 2019-01-29 20:25:13 -0500 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2019-01-30 13:22:59 +0100 |
commit | 3760e59c13c2eb0691249616d6b8e9a076b6690c (patch) | |
tree | 0b878d0540869136b9744e52c1240fae49ac3c54 /src/dh.c | |
parent | 3334443089c56f1d4a2922fe34c6204528ad9bd3 (diff) | |
download | libssh-3760e59c13c2eb0691249616d6b8e9a076b6690c.tar.gz libssh-3760e59c13c2eb0691249616d6b8e9a076b6690c.tar.xz libssh-3760e59c13c2eb0691249616d6b8e9a076b6690c.zip |
dh: harden error handling in 'ssh_dh_init_common'
Harden the error path in 'ssh_dh_init_common' such that
all potential allocations are free'd upon exit.
Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/dh.c')
-rw-r--r-- | src/dh.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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 { |