diff options
author | dgp <dgp@users.sourceforge.net> | 2009-03-18 17:08:11 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2009-03-18 17:08:11 (GMT) |
commit | 538c2afa4a7741c3a8a459feb9c27f13848b9e7b (patch) | |
tree | 04aea2d97bd7f76f7d0b156b41f62ff8bf15454e /win/tclWinFile.c | |
parent | c108da9362a1f3ad12bd7e73ad6524e9991762f3 (diff) | |
download | tcl-538c2afa4a7741c3a8a459feb9c27f13848b9e7b.zip tcl-538c2afa4a7741c3a8a459feb9c27f13848b9e7b.tar.gz tcl-538c2afa4a7741c3a8a459feb9c27f13848b9e7b.tar.bz2 |
* win/tclWinFile.c (TclpObjNormalizePath): Corrected Tcl_Obj leak.
Thanks to Joe Mistachkin for detection and patch. [Bug 2688184].
Diffstat (limited to 'win/tclWinFile.c')
-rw-r--r-- | win/tclWinFile.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c index bdbad41..46c8489 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.97 2008/10/26 18:43:27 dkf Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.98 2009/03/18 17:08:11 dgp Exp $ */ /* #define _WIN32_WINNT 0x0500 */ @@ -2554,6 +2554,7 @@ TclpObjNormalizePath( char *lastValidPathEnd = NULL; Tcl_DString dsNorm; /* This will hold the normalized string. */ char *path, *currentPathEndPosition; + Tcl_Obj *temp = NULL; Tcl_DStringInit(&dsNorm); path = Tcl_GetString(pathPtr); @@ -2711,7 +2712,6 @@ TclpObjNormalizePath( * We're on WinNT (or 2000 or XP; something with an NT core). */ - Tcl_Obj *temp = NULL; int isDrive = 1; Tcl_DString ds; @@ -2983,6 +2983,16 @@ TclpObjNormalizePath( Tcl_DStringFree(&dsTemp); } Tcl_DStringFree(&dsNorm); + + /* + * This must be done after we are totally finished with 'path' as we are + * sharing the same underlying string. + */ + + if (temp != NULL) { + Tcl_DecrRefCount(temp); + } + return nextCheckpoint; } |