aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom.smeding@gmail.com>2020-07-12 21:50:16 +0200
committerTom Smeding <tom.smeding@gmail.com>2020-07-12 21:50:16 +0200
commit282279c05f0ce892b1e65f7b6ae8046571d6eeb0 (patch)
treec48bbd4771ac78108ba8620ef4af786b32e7d1b9
parent5e27a5874aa1437a1a9b9974d26750d5520017e2 (diff)
tomsg_clientlib: Ensure tomsg_connect sets client to NULL on error
-rw-r--r--ssh/tomsg_clientlib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ssh/tomsg_clientlib.c b/ssh/tomsg_clientlib.c
index daa2cf5..9898b66 100644
--- a/ssh/tomsg_clientlib.c
+++ b/ssh/tomsg_clientlib.c
@@ -191,6 +191,9 @@ static enum tomsg_retval version_negotiation(struct tomsg_client *client) {
enum tomsg_retval tomsg_connect(
const char *hostname, int port, struct tomsg_client **clientp) {
+ // In case we throw an error along the way
+ *clientp = NULL;
+
struct sshnc_client *conn;
enum sshnc_retval ret = sshnc_connect(
hostname, port, "tomsg", "tomsg", hostkey_checker, NULL, &conn);