diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-07-27 17:32:16 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-07-27 17:32:16 +0200 |
commit | b51566ad3f8a4a28e7478171c5e23517bd2b4c62 (patch) | |
tree | 07eb6e4d14d77c216e663879ece6ac47ee797e92 /ssh/client_proxy.c | |
parent | 701c8add0d75f94ca2c34cafa686a54aee5854c6 (diff) |
ssh: Various connection closing fixes
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; } |