mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-04 12:20:42 +09:00
dh: fix libcrypto dh_ctx leak in ssh_dh_cleanup
Ensure to free the `dh_ctx` member in `ssh_dh_cleanup` to match
the allocation in `ssh_dh_init_common`.
The before-and-after of this change can be observed with the pkd
tests and valgrind:
valgrind --leak-check=full \
./pkd_hello -i1 -t torture_pkd_openssh_dsa_rsa_diffie_hellman_group16_sha512
Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
ee82bab801
commit
ee42e3badb
@@ -180,6 +180,7 @@ void ssh_dh_cleanup(struct ssh_crypto_struct *crypto)
|
||||
if (crypto->dh_ctx != NULL) {
|
||||
DH_free(crypto->dh_ctx->keypair[0]);
|
||||
DH_free(crypto->dh_ctx->keypair[1]);
|
||||
free(crypto->dh_ctx);
|
||||
crypto->dh_ctx = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user