chan: fix potential path leak on clone in namec() (from erik quanstroms 9atom)
This commit is contained in:
parent
91818e7081
commit
d0bb0f7757
1 changed files with 5 additions and 0 deletions
|
@ -1472,6 +1472,10 @@ namec(char *aname, int amode, int omode, ulong perm)
|
|||
/* save&update the name; domount might change c */
|
||||
path = c->path;
|
||||
incref(path);
|
||||
if(waserror()){
|
||||
pathclose(path);
|
||||
nexterror();
|
||||
}
|
||||
m = nil;
|
||||
if(!nomount)
|
||||
domount(&c, &m, &path);
|
||||
|
@ -1482,6 +1486,7 @@ namec(char *aname, int amode, int omode, ulong perm)
|
|||
/* now it's our copy anyway, we can put the name back */
|
||||
pathclose(c->path);
|
||||
c->path = path;
|
||||
poperror();
|
||||
|
||||
/* record whether c is on a mount point */
|
||||
c->ismtpt = m!=nil;
|
||||
|
|
Loading…
Reference in a new issue