ref: cda46731d8166e5b113a8acdf90479a03bb6a3a8
parent: e2a5d674d9d22492220200824a9ec28f95a02253
author: cinap_lenrek <[email protected]>
date: Mon Jun 8 23:33:37 EDT 2015
devsegment: fix parsecmd() memory leak
--- a/sys/src/9/port/devsegment.c
+++ b/sys/src/9/port/devsegment.c
@@ -315,6 +315,10 @@
switch(TYPE(c)){
case Qctl:
cb = parsecmd(a, n);
+ if(waserror()){
+ free(cb);
+ nexterror();
+ }
if(strcmp(cb->f[0], "va") == 0){
if(g->s != nil)
error("already has a virtual address");
@@ -335,6 +339,8 @@
g->s = newseg(SG_SHARED, va, len);
} else
error(Ebadctl);
+ free(cb);
+ poperror();
break;
case Qdata:
return segio(g, g->s, a, n, voff, 0);