Commit Diff


commit - 98c3d8979f42c71c2eb00894d54d1618a2340b9f
commit + ab4b80221c5e35c28fb9f16512fd161aa127db2a
blob - 4b7e793ce8230625df932f11cb3a24941a977f15
blob + 857a4694509084a459e7014d051d628690d2902c
--- lstun.c
+++ lstun.c
@@ -247,10 +247,9 @@ try_to_connect(int fd, short event, void *d)
 {
 	struct conn *c = d;
 
-	/* ssh may die in the meantime */
+	/* ssh may have died in the meantime */
 	if (ssh_pid == -1) {
-		close(c->source);
-		c->source = -1;
+		conn_free(c);
 		return;
 	}
 
@@ -261,8 +260,7 @@ try_to_connect(int fd, short event, void *d)
 	if ((c->to = connect_to_ssh()) == -1) {
 		if (c->ntentative == RETRIES) {
 			log_warnx("giving up connecting");
-			close(c->source);
-			c->source = -1;
+			conn_free(c);
 			return;
 		}