summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/9/port/devshr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/src/9/port/devshr.c b/sys/src/9/port/devshr.c
index bc7677210..96e319221 100644
--- a/sys/src/9/port/devshr.c
+++ b/sys/src/9/port/devshr.c
@@ -554,6 +554,7 @@ shrremove(Chan *c)
Sch *sch;
Mpt *mpt;
Mhead *h;
+ Chan *bc;
sch = tosch(c);
if(waserror()){
@@ -593,6 +594,7 @@ shrremove(Chan *c)
qunlock(&shrslk);
break;
case Qcmpt:
+ bc = nil;
mpt = sch->mpt;
m = &mpt->m;
h = &shr->umh;
@@ -601,10 +603,14 @@ shrremove(Chan *c)
if(*ml == m){
*ml = m->next;
m->next = nil;
+ bc = m->to;
+ m->to = nil;
putmpt(mpt);
break;
}
wunlock(&h->lock);
+ if(bc != nil)
+ cclose(bc);
break;
}
poperror();