summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2009-03-18 17:13:45 (GMT)
committerdgp <dgp@users.sourceforge.net>2009-03-18 17:13:45 (GMT)
commitba8ebbff1d8a0c56faa5687b97762896372a7d97 (patch)
treea50538bbe83cdff8c9b4a2dc5c3ddb3cf61384d6 /win
parente9faab76a114f2450bf2bc9966992e0e180efe30 (diff)
downloadtcl-ba8ebbff1d8a0c56faa5687b97762896372a7d97.zip
tcl-ba8ebbff1d8a0c56faa5687b97762896372a7d97.tar.gz
tcl-ba8ebbff1d8a0c56faa5687b97762896372a7d97.tar.bz2
* win/tclWinFile.c (TclpObjNormalizePath): Corrected Tcl_Obj leak.
Thanks to Joe Mistachkin for detection and patch. [Bug 2688184].
Diffstat (limited to 'win')
-rw-r--r--win/tclWinFile.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 4a909f3..6e6b713 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.95.2.1 2008/04/05 23:22:41 kennykb Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.95.2.2 2009/03/18 17:13:45 dgp Exp $
*/
/* #define _WIN32_WINNT 0x0500 */
@@ -2552,6 +2552,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);
@@ -2709,7 +2710,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;
@@ -2981,6 +2981,15 @@ 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;
}