aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2015-09-21 15:01:37 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2015-09-21 15:01:37 +0200
commit73d8c919b7b6cc8f5936ff6adc0cafdd45cd393b (patch)
treefcfa20102ee7e1e327f04c7a7644a6182db11d7b
parent747e7d05db4ef4b9c2204c58dfb0125eb5394ba3 (diff)
downloadlibssh-73d8c919b7b6cc8f5936ff6adc0cafdd45cd393b.tar.gz
libssh-73d8c919b7b6cc8f5936ff6adc0cafdd45cd393b.tar.xz
libssh-73d8c919b7b6cc8f5936ff6adc0cafdd45cd393b.zip
crypto: fix potential memory leak in ECDH
-rw-r--r--src/wrapper.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wrapper.c b/src/wrapper.c
index c1dd4d03..b750702d 100644
--- a/src/wrapper.c
+++ b/src/wrapper.c
@@ -160,6 +160,10 @@ void crypto_free(struct ssh_crypto_struct *crypto){
#ifdef HAVE_ECDH
SAFE_FREE(crypto->ecdh_client_pubkey);
SAFE_FREE(crypto->ecdh_server_pubkey);
+ if(crypto->ecdh_privkey != NULL){
+ EC_KEY_free(crypto->ecdh_privkey);
+ crypto->ecdh_privkey = NULL;
+ }
#endif
if(crypto->session_id != NULL){
memset(crypto->session_id, '\0', crypto->digest_len);