shithub: riscv

Download patch

ref: 7a3ceb58fc7fec964b251686dd87d4aca46d4573
parent: 81f3b1a233a10fdba00dbeae02fecc2c01d8bca3
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Apr 3 10:29:49 EDT 2019

sshnet: don't leak error string

--- a/sys/src/cmd/sshnet.c
+++ b/sys/src/cmd/sshnet.c
@@ -1103,12 +1103,11 @@
 			break;
 		}
 		c = getclient(chan);
-		if(c == nil || c->state != Dialing){
-			free(s);
-			break;
+		if(c != nil && c->state == Dialing){
+			c->state = Closed;
+			hangupclient(c, s);
 		}
-		c->state = Closed;
-		hangupclient(c, s);
+		free(s);
 		break;
 	}
 	free(m);