diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-05-01 19:03:56 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-05-01 19:03:56 +0200 |
commit | 91818e708136552d7182e86c41c4a551e969418f (patch) | |
tree | cb360e46b9c1ba0b3c05afc6b6dd4578ad634dd8 /sys/src/9/port/devpipe.c | |
parent | 0124d865a625045bf062110c8eb38839342dedf2 (diff) |
devpipe: fix channel and queue leaks (from erik quanstroms 9atom)
Diffstat (limited to 'sys/src/9/port/devpipe.c')
-rw-r--r-- | sys/src/9/port/devpipe.c | 7 |
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; |