From b51566ad3f8a4a28e7478171c5e23517bd2b4c62 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Mon, 27 Jul 2020 17:32:16 +0200 Subject: ssh: Various connection closing fixes --- ssh/client_proxy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ssh/client_proxy.c') diff --git a/ssh/client_proxy.c b/ssh/client_proxy.c index 1ce5e12..369ed0a 100644 --- a/ssh/client_proxy.c +++ b/ssh/client_proxy.c @@ -51,14 +51,14 @@ static void* proxy_thread_entry(void *thread_data_) { struct thread_data *thread_data = thread_data_; int client_sock = thread_data->client_sock; - struct sshnc_client *client; + struct sshnc_client *client = NULL; enum sshnc_retval ret = sshnc_connect( thread_data->server_host, thread_data->server_port, "tomsg", "tomsg", hostkey_checker, NULL, &client); if (ret != SSHNC_OK) { fprintf(stderr, "Could not connect over SSH: %s\n", sshnc_strerror(ret)); - return NULL; + goto cleanup; } struct pollfd polls[2]; @@ -137,7 +137,7 @@ static void* proxy_thread_entry(void *thread_data_) { cleanup: close(client_sock); - sshnc_close(client); + if (client) sshnc_close(client); return NULL; } -- cgit v1.2.3-54-g00ecf