shithub: riscv

Download patch

ref: 48a82f2641935cb1e7b9e08bf86ce5c506d02953
parent: d4033c31bb1707cc4d2c6c394a6e1793bc1d6d04
author: cinap_lenrek <[email protected]>
date: Tue Apr 2 14:06:25 EDT 2019

sshnet: fix memory leak

--- a/sys/src/cmd/sshnet.c
+++ b/sys/src/cmd/sshnet.c
@@ -805,13 +805,11 @@
 			goto Badarg;
 		if(nf != 2)
 			goto Badarg;
+		free(c->connect);
 		c->connect = estrdup9p(f[1]);
 		nf = getfields(f[1], f, nelem(f), 0, "!");
-		if(nf != 2){
-			free(c->connect);
-			c->connect = nil;
+		if(nf != 2)
 			goto Badarg;
-		}
 		c->sendwin = MaxPacket;
 		c->recvwin = WinPackets * MaxPacket;
 		c->recvacc = 0;