summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2004-12-02 23:24:54 (GMT)
committerdgp <dgp@users.sourceforge.net>2004-12-02 23:24:54 (GMT)
commit280176a51c41883a5e086a971004ec6e6ab1820e (patch)
treec793de357ee6b036d50f0a0bc464a7cd38856f2d /generic/tclUtil.c
parente05bd52770456e6db2d99f2112bb78fae3619235 (diff)
downloadtcl-280176a51c41883a5e086a971004ec6e6ab1820e.zip
tcl-280176a51c41883a5e086a971004ec6e6ab1820e.tar.gz
tcl-280176a51c41883a5e086a971004ec6e6ab1820e.tar.bz2
* generic/tclUtil.c (TclSetProcessGlobalValue): Handle the case
where a ProcessGlobalValue might be assigned to itself. * generic/tclEncoding.c (MakeFileMap): Correct refcounting errors managing values returned by TclPathPart (with refCount of 1!) that led to a memory leak. [Bug 1077474].
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r--generic/tclUtil.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index e7941b3..d36aabf 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.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: tclUtil.c,v 1.51 2004/12/02 00:09:40 dgp Exp $
+ * RCS: @(#) $Id: tclUtil.c,v 1.52 2004/12/02 23:24:57 dgp Exp $
*/
#include "tclInt.h"
@@ -2705,13 +2705,14 @@ TclSetProcessGlobalValue(pgvPtr, newValue, encoding)
/*
* Fill the local thread copy directly with the Tcl_Obj
- * value to avoid loss of the intrep
+ * value to avoid loss of the intrep. Increment newValue
+ * refCount early to handle case where we set a PGV to itself.
*/
+ Tcl_IncrRefCount(newValue);
cacheMap = GetThreadHash(&pgvPtr->key);
ClearHash(cacheMap);
hPtr = Tcl_CreateHashEntry(cacheMap, (char *)pgvPtr->epoch, &dummy);
Tcl_SetHashValue(hPtr, (ClientData) newValue);
- Tcl_IncrRefCount(newValue);
Tcl_MutexUnlock(&pgvPtr->mutex);
}