summaryrefslogtreecommitdiffstats
path: root/generic/tclPathObj.c
diff options
context:
space:
mode:
authordgp <dgp@noemail.net>2008-06-29 19:09:27 (GMT)
committerdgp <dgp@noemail.net>2008-06-29 19:09:27 (GMT)
commit49a8366e138b96915cb26c0d810bfaf9a868810b (patch)
tree1e38095c9b2946ea35afb9a963f2752dbe01573d /generic/tclPathObj.c
parent930cec24d4fed52e4ac3c09a15eb809ac89c0c59 (diff)
downloadtcl-49a8366e138b96915cb26c0d810bfaf9a868810b.zip
tcl-49a8366e138b96915cb26c0d810bfaf9a868810b.tar.gz
tcl-49a8366e138b96915cb26c0d810bfaf9a868810b.tar.bz2
* generic/tclPathObj.c: Plug memory leak in [Bug 1999176] fix. Thanks
to Rolf Ade for detecting. FossilOrigin-Name: 47846b80dd0cd2bcc3236c71f7b06482c41ee8fb
Diffstat (limited to 'generic/tclPathObj.c')
-rw-r--r--generic/tclPathObj.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c
index b52e0b0..475bf7f 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.71 2008/06/28 04:23:00 dgp Exp $
+ * RCS: @(#) $Id: tclPathObj.c,v 1.72 2008/06/29 19:09:28 dgp Exp $
*/
#include "tclInt.h"
@@ -1878,6 +1878,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
@@ -1926,6 +1927,7 @@ Tcl_FSGetNormalizedPath(
return NULL;
}
+ pureNormalized = 0;
Tcl_DecrRefCount(absolutePath);
absolutePath = Tcl_FSJoinToPath(useThisCwd, 1, &absolutePath);
Tcl_IncrRefCount(absolutePath);
@@ -1945,6 +1947,7 @@ Tcl_FSGetNormalizedPath(
if (absolutePath == NULL) {
return NULL;
}
+ pureNormalized = 0;
#endif /* __WIN32__ */
}
}
@@ -1966,7 +1969,7 @@ Tcl_FSGetNormalizedPath(
* is an absolute path).
*/
- if (useThisCwd == NULL) {
+ if (pureNormalized) {
if (!strcmp(TclGetString(fsPathPtr->normPathPtr),
TclGetString(pathPtr))) {
/*
@@ -1982,7 +1985,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