ref: afd1ec5d8881cf203967269f20833086a840d946
parent: a1637d7db92cd4d1b6dca46d6047fd95d774c4f8
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;
--
⑨