diff options
author | dgp <dgp@users.sourceforge.net> | 2008-06-29 19:08:35 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2008-06-29 19:08:35 (GMT) |
commit | 965a5b8a75586aafac30acda7c6a61c7ad1d2e8b (patch) | |
tree | 0c58fe6540fee3c0e0690c678dce54643f4e5180 /generic/tclPathObj.c | |
parent | d0b6a3cd4ce44821f6de7c20eae912e1a0248f4d (diff) | |
download | tcl-965a5b8a75586aafac30acda7c6a61c7ad1d2e8b.zip tcl-965a5b8a75586aafac30acda7c6a61c7ad1d2e8b.tar.gz tcl-965a5b8a75586aafac30acda7c6a61c7ad1d2e8b.tar.bz2 |
* generic/tclPathObj.c: Plug memory leak in [Bug 1999176] fix. Thanks
Rolf Ade for detecting.
Diffstat (limited to 'generic/tclPathObj.c')
-rw-r--r-- | generic/tclPathObj.c | 10 |
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 |