diff options
author | dgp <dgp@users.sourceforge.net> | 2008-06-29 19:09:27 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2008-06-29 19:09:27 (GMT) |
commit | 7b7bac281c6cba5b97c0962a4032cc39dcc6308f (patch) | |
tree | 1e38095c9b2946ea35afb9a963f2752dbe01573d /generic/tclPathObj.c | |
parent | c6c29d28443648a0ed28f4773d2e7b127564c7e6 (diff) | |
download | tcl-7b7bac281c6cba5b97c0962a4032cc39dcc6308f.zip tcl-7b7bac281c6cba5b97c0962a4032cc39dcc6308f.tar.gz tcl-7b7bac281c6cba5b97c0962a4032cc39dcc6308f.tar.bz2 |
* generic/tclPathObj.c: Plug memory leak in [Bug 1999176] fix. Thanks
to 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 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 |