Bug fixes from the Valgrind oracle.
diff --git a/src/lib9/dirread.c b/src/lib9/dirread.c
index 4105e87..db80c35 100644
--- a/src/lib9/dirread.c
+++ b/src/lib9/dirread.c
@@ -11,6 +11,7 @@
 mygetdents(int fd, struct dirent *buf, int n)
 {
 	off_t off;
+	int nn;
 
 	off = p9seek(fd, 0, 1);
 	nn = getdirentries(fd, (void*)buf, n, &off);
diff --git a/src/libfs/fs.c b/src/libfs/fs.c
index c06e19d..b34df34 100644
--- a/src/libfs/fs.c
+++ b/src/libfs/fs.c
@@ -199,7 +199,7 @@
 
 	qlock(&fs->lk);
 	if(fs->freefid == nil){
-		f = malloc(sizeof(Fid)*Fidchunk);
+		f = mallocz(sizeof(Fid)*Fidchunk, 1);
 		if(f == nil){
 			qunlock(&fs->lk);
 			return nil;
diff --git a/src/libmux/mux.c b/src/libmux/mux.c
index 7a21b44..b1fdeb0 100644
--- a/src/libmux/mux.c
+++ b/src/libmux/mux.c
@@ -81,6 +81,7 @@
 			}
 			r2 = mux->wait[tag];
 			r2->p = p;
+			dequeue(mux, r2);
 			rwakeup(&r2->r);
 		}
 		mux->muxer = 0;
@@ -131,6 +132,7 @@
 				w = realloc(mux->wait, mw*sizeof(w[0]));
 				if(w == nil)
 					return -1;
+				memset(w+mux->mwait, 0, (mw-mux->mwait)*sizeof(w[0]));
 				mux->wait = w;
 				mux->freetag = mux->mwait;
 				mux->mwait = mw;