summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2009-03-18 17:08:11 (GMT)
committerdgp <dgp@users.sourceforge.net>2009-03-18 17:08:11 (GMT)
commit538c2afa4a7741c3a8a459feb9c27f13848b9e7b (patch)
tree04aea2d97bd7f76f7d0b156b41f62ff8bf15454e
parentc108da9362a1f3ad12bd7e73ad6524e9991762f3 (diff)
downloadtcl-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].
-rw-r--r--ChangeLog3
-rw-r--r--win/tclWinFile.c14
2 files changed, 15 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d52c8e5..f8e4462 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2009-03-18 Don Porter <dgp@users.sourceforge.net>
+ * win/tclWinFile.c (TclpObjNormalizePath): Corrected Tcl_Obj leak.
+ Thanks to Joe Mistachkin for detection and patch. [Bug 2688184].
+
* generic/tclVar.c (TclLookupSimpleVar): Shift all calls to
Tcl_SetErrorCode() out of TclLookupSimpleVar and onto its callers,
where control with TCL_LEAVE_ERR_MSG flag is more easily handled.
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;
}