ref: 37984a928f85fb9277fcbdae1ae81ede99f70871
parent: d30c1aec7c4269b1517c4bb02bedc0c27a3cf9b7
author: cinap_lenrek <cinap_lenrek@rei2.9hal>
date: Sat Jan 28 15:29:55 EST 2012
rio: fix memory leak for w->dir
--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -1190,8 +1190,10 @@
}
wsetpid(w, pid, 1);
wsetname(w);
- if(dir)
+ if(dir){+ free(w->dir);
w->dir = estrdup(dir);
+ }
chanfree(cpid);
return w;
}
--- a/sys/src/cmd/rio/util.c
+++ b/sys/src/cmd/rio/util.c
@@ -81,6 +81,7 @@
p = malloc(strlen(s)+1);
if(p == nil)
error("strdup failed");+ setmalloctag(p, getcallerpc(&s));
strcpy(p, s);
return p;
}
--
⑨