rio: fix memory leak for w->dir
This commit is contained in:
parent
1c521567a1
commit
21cedbedb2
|
@ -1190,8 +1190,10 @@ new(Image *i, int hideit, int scrollit, int pid, char *dir, char *cmd, char **ar
|
|||
}
|
||||
wsetpid(w, pid, 1);
|
||||
wsetname(w);
|
||||
if(dir)
|
||||
if(dir){
|
||||
free(w->dir);
|
||||
w->dir = estrdup(dir);
|
||||
}
|
||||
chanfree(cpid);
|
||||
return w;
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ estrdup(char *s)
|
|||
p = malloc(strlen(s)+1);
|
||||
if(p == nil)
|
||||
error("strdup failed");
|
||||
setmalloctag(p, getcallerpc(&s));
|
||||
strcpy(p, s);
|
||||
return p;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue