ref: d0bb0f775761a292caa2d2720bd91a51b469710b
parent: 91818e708136552d7182e86c41c4a551e969418f
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Wed May 1 17:56:02 EDT 2013
chan: fix potential path leak on clone in namec() (from erik quanstroms 9atom)
--- a/sys/src/9/port/chan.c
+++ b/sys/src/9/port/chan.c
@@ -1472,6 +1472,10 @@
/* 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 @@
/* 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;
--
⑨