summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclIOUtil.c9
2 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 23169c6..883c80d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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);
}