summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/9/port/devpipe.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/src/9/port/devpipe.c b/sys/src/9/port/devpipe.c
index a72303dcc..5660c24ae 100644
--- a/sys/src/9/port/devpipe.c
+++ b/sys/src/9/port/devpipe.c
@@ -61,6 +61,10 @@ pipeattach(char *spec)
Chan *c;
c = devattach('|', spec);
+ if(waserror()){
+ chanfree(c);
+ nexterror();
+ }
p = malloc(sizeof(Pipe));
if(p == 0)
exhausted("memory");
@@ -73,10 +77,11 @@ pipeattach(char *spec)
}
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;