diff options
author | Kevin B Kenny <kennykb@acm.org> | 2007-04-25 19:09:03 (GMT) |
---|---|---|
committer | Kevin B Kenny <kennykb@acm.org> | 2007-04-25 19:09:03 (GMT) |
commit | 3e9935c9d0351de3a1b1da3f2c9dbb01e78799c7 (patch) | |
tree | fc7aa243eab8a38f2201fac2a7b4e093d1ecb89d | |
parent | bc808f183f4c2b6328fe0d9d44396e1147795f84 (diff) | |
download | tcl-3e9935c9d0351de3a1b1da3f2c9dbb01e78799c7.zip tcl-3e9935c9d0351de3a1b1da3f2c9dbb01e78799c7.tar.gz tcl-3e9935c9d0351de3a1b1da3f2c9dbb01e78799c7.tar.bz2 |
* generic/tclIOUtil.c (Tcl_FSChdir): Changed the memory management
to that the path returned from Tcl_FSGetNativePath is not
duplicated before being stored as the current directory, to avoid
a memory leak. [Bug 1705778, leak K01 among other manifestations]
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | generic/tclIOUtil.c | 9 |
2 files changed, 13 insertions, 3 deletions
@@ -1,3 +1,10 @@ +2007-04-25 Kevin B. Kenny <kennykb@acm.org> + + * generic/tclIOUtil.c (Tcl_FSChdir): Changed the memory management + so that the path returned from Tcl_FSGetNativePath is not + duplicated before being stored as the current directory, to avoid + a memory leak. [Bug 1705778, leak K01 among other manifestations] + 2007-04-25 Don Porter <dgp@users.sourceforge.net> * generic/tclCompExpr.c (ParseExpr): Revised to be sure that diff --git a/generic/tclIOUtil.c b/generic/tclIOUtil.c index a2b0555..5725e45 100644 --- a/generic/tclIOUtil.c +++ b/generic/tclIOUtil.c @@ -17,7 +17,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclIOUtil.c,v 1.144 2007/04/20 06:10:57 kennykb Exp $ + * RCS: @(#) $Id: tclIOUtil.c,v 1.145 2007/04/25 19:09:03 kennykb Exp $ */ #include "tclInt.h" @@ -2971,14 +2971,17 @@ Tcl_FSChdir( ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&tclFsDataKey); ClientData cd; + ClientData oldcd = tsdPtr->cwdClientData; /* * Assumption we are using a filesystem version 2. */ TclFSGetCwdProc2 *proc2 = (TclFSGetCwdProc2*)fsPtr->getCwdProc; - cd = (*proc2)(tsdPtr->cwdClientData); - FsUpdateCwd(normDirName, TclNativeDupInternalRep(cd)); + cd = (*proc2)(oldcd); + if (cd != oldcd) { + FsUpdateCwd(normDirName, cd); + } } else { FsUpdateCwd(normDirName, NULL); } |