summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@centraldogma>2011-08-10 17:26:05 +0200
committercinap_lenrek <cinap_lenrek@centraldogma>2011-08-10 17:26:05 +0200
commit4b506cd0aebaea584af7422bddc1f8743fac5ffe (patch)
tree6568212edb95102e683697b8a11e7eddbc8ce24e
parent70e4b8d1f957b900f784d9f7205ab2a96d7e440a (diff)
downloadplan9front-4b506cd0aebaea584af7422bddc1f8743fac5ffe.tar.xz
qio: fix block leak introduced by eqlock change
-rw-r--r--sys/src/9/port/qio.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/src/9/port/qio.c b/sys/src/9/port/qio.c
index c91cad04c..8fb108511 100644
--- a/sys/src/9/port/qio.c
+++ b/sys/src/9/port/qio.c
@@ -1173,14 +1173,10 @@ qbwrite(Queue *q, Block *b)
}
dowakeup = 0;
- eqlock(&q->wlock);
if(waserror()){
- if(b != nil)
- freeb(b);
- qunlock(&q->wlock);
+ freeb(b);
nexterror();
}
-
ilock(q);
/* give up if the queue is closed */
@@ -1194,7 +1190,6 @@ qbwrite(Queue *q, Block *b)
if(q->noblock){
iunlock(q);
freeb(b);
- qunlock(&q->wlock);
poperror();
return n;
}
@@ -1214,7 +1209,6 @@ qbwrite(Queue *q, Block *b)
q->len += BALLOC(b);
q->dlen += n;
QDEBUG checkb(b, "qbwrite");
- b = nil;
/* make sure other end gets awakened */
if(q->state & Qstarve){
@@ -1222,6 +1216,7 @@ qbwrite(Queue *q, Block *b)
dowakeup = 1;
}
iunlock(q);
+ poperror();
/* get output going again */
if(q->kick && (dowakeup || (q->state&Qkick)))
@@ -1255,12 +1250,17 @@ qbwrite(Queue *q, Block *b)
ilock(q);
q->state |= Qflow;
iunlock(q);
+
+ eqlock(&q->wlock);
+ if(waserror()){
+ qunlock(&q->wlock);
+ nexterror();
+ }
sleep(&q->wr, qnotfull, q);
+ qunlock(&q->wlock);
+ poperror();
}
- USED(b);
- qunlock(&q->wlock);
- poperror();
return n;
}