summaryrefslogtreecommitdiffstats
path: root/libssh/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'libssh/client.c')
-rw-r--r--libssh/client.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libssh/client.c b/libssh/client.c
index b79c605..76645e5 100644
--- a/libssh/client.c
+++ b/libssh/client.c
@@ -213,7 +213,13 @@ static int dh_handshake(SSH_SESSION *session){
crypto_free(session->current_crypto);
/* XXX later, include a function to change keys */
session->current_crypto=session->next_crypto;
- session->next_crypto=crypto_new();
+
+ session->next_crypto = crypto_new();
+ if (session->next_crypto == NULL) {
+ leave_function();
+ return SSH_ERROR;
+ }
+
session->dh_handshake_state=DH_STATE_FINISHED;
leave_function();
return SSH_OK;