rio: fix memory leak for w->dir

This commit is contained in:
cinap_lenrek 2012-01-28 20:29:55 +01:00
parent 1c521567a1
commit 21cedbedb2
2 changed files with 4 additions and 1 deletions

View file

@ -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;
}

View file

@ -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;
}