ref: 91818e708136552d7182e86c41c4a551e969418f
parent: 0124d865a625045bf062110c8eb38839342dedf2
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Wed May 1 15:03:56 EDT 2013
devpipe: fix channel and queue leaks (from erik quanstroms 9atom)
--- a/sys/src/9/port/devpipe.c
+++ b/sys/src/9/port/devpipe.c
@@ -61,6 +61,10 @@
Chan *c;
c = devattach('|', spec);+ if(waserror()){+ chanfree(c);
+ nexterror();
+ }
p = malloc(sizeof(Pipe));
if(p == 0)
exhausted("memory");@@ -73,10 +77,11 @@
}
p->q[1] = qopen(conf.pipeqsize, 0, 0, 0);
if(p->q[1] == 0){- free(p->q[0]);
+ qfree(p->q[0]);
free(p);
exhausted("memory");}
+ poperror();
lock(&pipealloc);
p->path = ++pipealloc.path;
--
⑨