summaryrefslogtreecommitdiffstats
path: root/win/tclWinFile.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2009-03-18 17:18:54 (GMT)
committerdgp <dgp@users.sourceforge.net>2009-03-18 17:18:54 (GMT)
commit653bcd908ccbb5daff9e2e4b6e01f64076a9247a (patch)
treed8691b015184f60db3d41b26c0e140bc032ec0e6 /win/tclWinFile.c
parent66e884275c19a6e17f016bf828eed7b61431888b (diff)
downloadtcl-653bcd908ccbb5daff9e2e4b6e01f64076a9247a.zip
tcl-653bcd908ccbb5daff9e2e4b6e01f64076a9247a.tar.gz
tcl-653bcd908ccbb5daff9e2e4b6e01f64076a9247a.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.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index c87edc3..8e35533 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.44.2.18 2006/10/17 04:36:45 dgp Exp $
+ * RCS: @(#) $Id: tclWinFile.c,v 1.44.2.19 2009/03/18 17:18:54 dgp Exp $
*/
//#define _WIN32_WINNT 0x0500
@@ -2324,6 +2324,7 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint)
Tcl_DString dsNorm;
char *path;
char *currentPathEndPosition;
+ Tcl_Obj *temp = NULL;
Tcl_DStringInit(&dsNorm);
path = Tcl_GetString(pathPtr);
@@ -2420,7 +2421,6 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint)
}
} else {
/* We're on WinNT or 2000 or XP */
- Tcl_Obj *temp = NULL;
int isDrive = 1;
Tcl_DString ds;
@@ -2609,6 +2609,16 @@ TclpObjNormalizePath(interp, pathPtr, nextCheckpoint)
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;
}