shithub: riscv

Download patch

ref: 81f3b1a233a10fdba00dbeae02fecc2c01d8bca3
parent: 2251ef7a32f881ae2c80989d5285db943aa2073b
author: cinap_lenrek <[email protected]>
date: Wed Apr 3 10:16:28 EDT 2019

sshnet: don't leak "Dialing" connections when "connect" ctl write gets interrupted

--- a/sys/src/cmd/sshnet.c
+++ b/sys/src/cmd/sshnet.c
@@ -1086,11 +1086,13 @@
 		c->sendpkt = pkt;
 		c->sendwin = win;
 		c->servernum = n;
-		c->state = Established;
-		if(c->wq != nil){
-			respond(c->wq, nil);
-			c->wq = nil;
+		if(c->wq == nil){
+			teardownclient(c);
+			break;
 		}
+		respond(c->wq, nil);
+		c->wq = nil;
+		c->state = Established;
 		break;
 	case MSG_CHANNEL_OPEN_FAILURE:
 		if(unpack(m, "_u____s", &chan, &s, &n) < 0)