shithub: riscv

Download patch

ref: 22c758478072c9323fce68dd076efdb8213f5c61
parent: 6680d50d4bf09ef2fe11dd433be4db8db9c40b29
author: cinap_lenrek <[email protected]>
date: Mon Oct 22 17:59:52 EDT 2012

devproc: fix another channel leak, move the cclose(c) from proctext() to procopen.

--- a/sys/src/9/port/devproc.c
+++ b/sys/src/9/port/devproc.c
@@ -393,6 +393,7 @@
 		tc->offset = 0;
 		qunlock(&p->debug);
 		poperror();
+		cclose(c);
 		return tc;
 
 	case Qproc:
@@ -1203,12 +1204,13 @@
 		error(Eprocdied);
 	}
 
-	if(p->pid != PID(c->qid))
+	if(p->pid != PID(c->qid)) {
+		cclose(tc);
 		error(Eprocdied);
+	}
 
 	unlock(i);
 	poperror();
-	cclose(c);
 
 	return tc;
 }