summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2008-06-29 19:08:35 (GMT)
committerdgp <dgp@users.sourceforge.net>2008-06-29 19:08:35 (GMT)
commit2bffd8d5aed969e0ddf772e0d66f0dcc741ac03f (patch)
tree0c58fe6540fee3c0e0690c678dce54643f4e5180 /generic
parent7e889ea1e3186f0fa678da5b27a2156d324fbcfa (diff)
downloadtcl-2bffd8d5aed969e0ddf772e0d66f0dcc741ac03f.zip
tcl-2bffd8d5aed969e0ddf772e0d66f0dcc741ac03f.tar.gz
tcl-2bffd8d5aed969e0ddf772e0d66f0dcc741ac03f.tar.bz2
* generic/tclPathObj.c: Plug memory leak in [Bug 1999176] fix. Thanks
Rolf Ade for detecting.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclPathObj.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index 070bb2e..cdf6e2b 100644
--- a/generic/tclPathObj.c
+++ b/generic/tclPathObj.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclPathObj.c,v 1.66.2.3 2008/06/28 04:22:06 dgp Exp $
+ * RCS: @(#) $Id: tclPathObj.c,v 1.66.2.4 2008/06/29 19:08:36 dgp Exp $
*/
#include "tclInt.h"
@@ -1879,6 +1879,7 @@ Tcl_FSGetNormalizedPath(
if (fsPathPtr->normPathPtr == NULL) {
ClientData clientData = NULL;
Tcl_Obj *useThisCwd = NULL;
+ int pureNormalized = 1;
/*
* Since normPathPtr is NULL, but this is a valid path object, we know
@@ -1927,6 +1928,7 @@ Tcl_FSGetNormalizedPath(
return NULL;
}
+ pureNormalized = 0;
Tcl_DecrRefCount(absolutePath);
absolutePath = Tcl_FSJoinToPath(useThisCwd, 1, &absolutePath);
Tcl_IncrRefCount(absolutePath);
@@ -1946,6 +1948,7 @@ Tcl_FSGetNormalizedPath(
if (absolutePath == NULL) {
return NULL;
}
+ pureNormalized = 0;
#endif /* __WIN32__ */
}
}
@@ -1967,7 +1970,7 @@ Tcl_FSGetNormalizedPath(
* is an absolute path).
*/
- if (useThisCwd == NULL) {
+ if (pureNormalized) {
if (!strcmp(TclGetString(fsPathPtr->normPathPtr),
TclGetString(pathPtr))) {
/*
@@ -1983,7 +1986,8 @@ Tcl_FSGetNormalizedPath(
fsPathPtr->normPathPtr = pathPtr;
}
- } else {
+ }
+ if (useThisCwd != NULL) {
/*
* We just need to free an object we allocated above for relative
* paths (this was returned by Tcl_FSJoinToPath above), and then