diff options
Diffstat (limited to 'ssh/client_proxy.c')
-rw-r--r-- | ssh/client_proxy.c | 6 |
1 files changed, 3 insertions, 3 deletions
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; } |