diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-05-01 21:56:02 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-05-01 21:56:02 +0200 |
commit | d0bb0f775761a292caa2d2720bd91a51b469710b (patch) | |
tree | 43def1f1e419dd5879824f4e4dd6eda8fcf9c059 /sys/src | |
parent | 91818e708136552d7182e86c41c4a551e969418f (diff) |
chan: fix potential path leak on clone in namec() (from erik quanstroms 9atom)
Diffstat (limited to 'sys/src')
-rw-r--r-- | sys/src/9/port/chan.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/src/9/port/chan.c b/sys/src/9/port/chan.c index 262b0703d..d0d0ce4bb 100644 --- a/sys/src/9/port/chan.c +++ b/sys/src/9/port/chan.c @@ -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; |