From 6052b2df787cde54e20e2833c6a6dbaadb10bdd4 Mon Sep 17 00:00:00 2001 From: dkf Date: Sun, 11 Jul 2004 23:01:28 +0000 Subject: Stop [dict unset] from leaking objects. [Bug 989093 in part] --- ChangeLog | 5 +++++ generic/tclDictObj.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d51767..bcb61cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-07-11 Donal K. Fellows + + * generic/tclDictObj.c (Tcl_DictObjRemoveKeyList): Oops, forgot to + delete value object when removing the hash entry. [Bug 989093 in part] + 2004-07-11 Miguel Sofer * generic/tclExecute.c (TEBC): fixed leak of expandNestList objs diff --git a/generic/tclDictObj.c b/generic/tclDictObj.c index c29ac40..4b5f4d4 100644 --- a/generic/tclDictObj.c +++ b/generic/tclDictObj.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclDictObj.c,v 1.16 2004/05/27 13:18:53 dkf Exp $ + * RCS: @(#) $Id: tclDictObj.c,v 1.17 2004/07/11 23:01:28 dkf Exp $ */ #include "tclInt.h" @@ -1024,7 +1024,7 @@ Tcl_DictObjDone(searchPtr) /* *---------------------------------------------------------------------- * - * Tcl_DictObjRemoveKeyList -- + * Tcl_DictObjPutKeyList -- * * Add a key...key,value pair to a dictionary tree. The main * dictionary value must not be shared, though sub-dictionaries may @@ -1122,6 +1122,8 @@ Tcl_DictObjRemoveKeyList(interp, dictPtr, keyc, keyv) dict = (Dict *) dictPtr->internalRep.otherValuePtr; hPtr = Tcl_FindHashEntry(&dict->table, (char *)keyv[keyc-1]); if (hPtr != NULL) { + Tcl_Obj *oldValuePtr = (Tcl_Obj *) Tcl_GetHashValue(hPtr); + Tcl_DecrRefCount(oldValuePtr); Tcl_DeleteHashEntry(hPtr); } InvalidateDictChain(dictPtr); -- cgit v0.12