diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | generic/tclEncoding.c | 6 | ||||
-rw-r--r-- | generic/tclUtil.c | 7 |
3 files changed, 16 insertions, 6 deletions
@@ -1,3 +1,12 @@ +2004-12-02 Don Porter <dgp@users.sourceforge.net> + + * 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]. + 2004-12-02 Vince Darley <vincentdarley@users.sourceforge.net> * generic/tclPathObj.c: fix and new tests for [Bug 1074671] to diff --git a/generic/tclEncoding.c b/generic/tclEncoding.c index 1d2c0b8..3cbf450 100644 --- a/generic/tclEncoding.c +++ b/generic/tclEncoding.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclEncoding.c,v 1.29 2004/12/01 23:18:50 dgp Exp $ + * RCS: @(#) $Id: tclEncoding.c,v 1.30 2004/12/02 23:24:57 dgp Exp $ */ #include "tclInt.h" @@ -410,10 +410,10 @@ MakeFileMap() Tcl_Obj *encodingName, *file; file = TclPathPart(NULL, filev[j], TCL_PATH_TAIL); - Tcl_IncrRefCount(file); encodingName = TclPathPart(NULL, file, TCL_PATH_ROOT); - Tcl_IncrRefCount(encodingName); Tcl_DictObjPut(NULL, map, encodingName, directory); + Tcl_DecrRefCount(file); + Tcl_DecrRefCount(encodingName); } Tcl_DecrRefCount(matchFileList); Tcl_DecrRefCount(directory); 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); } |