chan: fix potential path leak on clone in namec() (from erik quanstroms 9atom)

This commit is contained in:
cinap_lenrek 2013-05-01 21:56:02 +02:00
parent 91818e7081
commit d0bb0f7757

View file

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