devpipe: fix channel and queue leaks (from erik quanstroms 9atom)
This commit is contained in:
parent
0124d865a6
commit
91818e7081
1 changed files with 6 additions and 1 deletions
|
@ -61,6 +61,10 @@ pipeattach(char *spec)
|
||||||
Chan *c;
|
Chan *c;
|
||||||
|
|
||||||
c = devattach('|', spec);
|
c = devattach('|', spec);
|
||||||
|
if(waserror()){
|
||||||
|
chanfree(c);
|
||||||
|
nexterror();
|
||||||
|
}
|
||||||
p = malloc(sizeof(Pipe));
|
p = malloc(sizeof(Pipe));
|
||||||
if(p == 0)
|
if(p == 0)
|
||||||
exhausted("memory");
|
exhausted("memory");
|
||||||
|
@ -73,10 +77,11 @@ pipeattach(char *spec)
|
||||||
}
|
}
|
||||||
p->q[1] = qopen(conf.pipeqsize, 0, 0, 0);
|
p->q[1] = qopen(conf.pipeqsize, 0, 0, 0);
|
||||||
if(p->q[1] == 0){
|
if(p->q[1] == 0){
|
||||||
free(p->q[0]);
|
qfree(p->q[0]);
|
||||||
free(p);
|
free(p);
|
||||||
exhausted("memory");
|
exhausted("memory");
|
||||||
}
|
}
|
||||||
|
poperror();
|
||||||
|
|
||||||
lock(&pipealloc);
|
lock(&pipealloc);
|
||||||
p->path = ++pipealloc.path;
|
p->path = ++pipealloc.path;
|
||||||
|
|
Loading…
Reference in a new issue