From 7e5cfe7b8c9af9ddb94862cb919b25eb574f6e06 Mon Sep 17 00:00:00 2001 From: dkf Date: Thu, 25 Aug 2005 10:40:02 +0000 Subject: Fix memory leak caused by throwing away a duplicated object --- ChangeLog | 20 +++++++++++++------- generic/tclExecute.c | 9 ++++----- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08f3632..6fc4686 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,15 @@ +2005-08-25 Donal K. Fellows + + * generic/tclExecute.c (TEBC:INST_DICT_LAPPEND): Stop dropping a + duplicated object on the floor, which was a memory leak (and a wrong + result too). Thanks to Andreas Kupries for reporting this. + 2005-08-24 Andreas Kupries TIP#219 IMPLEMENTATION * doc/SetChanErr.3: ** New File **. Documentation of the new - channel API functions. + channel API functions. * generic/tcl.decls: Stub declarations of the new channel API. * generic/tclDecls.h: Regenerated * generic/tclStubInit.c: @@ -32,7 +38,7 @@ * tests/binary.test (binary-65.*) formatting floating point numbers with the largest and smallest possible significands, and added test cases for them. - + 2005-08-23 Mo DeJong * unix/configure.in: @@ -56,11 +62,11 @@ * generic/tclEvent.c (Tcl_Finalize): Removed a copy-and-paste accident that caused a (mostly harmless) double finalize of the - load and filesystem subsystems. + load and filesystem subsystems. * tests/clock.test: Eliminated the bad test clock-43.1, and split clock-50.1 into two tests, with a more permissive check on the error message for an out-of-range value. - + 2005-08-12 Kevin Kenny * generic/tclClock.c (MktimeObjCmd): @@ -71,7 +77,7 @@ Tcl's time can track system time on Linux even if TZ is not set. Changed ::tcl::clock::Mktime to check for failure, and added a test case that mimics failure but is really success. - + 2005-08-11 Kevin Kenny * generic/tclEvent.c: Eliminated the USE_THREAD_STORAGE @@ -87,7 +93,7 @@ * win/rules.vc: just a little bit cleaner.) * win/tcl.m4: * win/tclWinThrd.c: - + 2005-08-10 Kevin Kenny * generic/tclEvent.c (Tcl_Finalize): Pushed Tcl_FinalizeLoad and @@ -100,7 +106,7 @@ * tests/expr.test (expr-3.8): 'unix' because they get stack overflows on Win32 threaded builds, - + 2005-08-09 Vince Darley * generic/tclPathObj.c: fix to [file rootname] bug in optimized diff --git a/generic/tclExecute.c b/generic/tclExecute.c index ff165cf..94e489f 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclExecute.c,v 1.198 2005/07/23 01:32:04 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.199 2005/08/25 10:40:02 dkf Exp $ */ #include "tclInt.h" @@ -5018,11 +5018,10 @@ TclExecuteByteCode(interp, codePtr) if (valPtr == NULL) { valPtr = Tcl_NewListObj(1, tosPtr); } else if (Tcl_IsShared(valPtr)) { - Tcl_Obj *dupPtr = Tcl_DuplicateObj(valPtr); - - result = Tcl_ListObjAppendElement(interp, dupPtr, *tosPtr); + valPtr = Tcl_DuplicateObj(valPtr); + result = Tcl_ListObjAppendElement(interp, valPtr, *tosPtr); if (result != TCL_OK) { - Tcl_DecrRefCount(dupPtr); + Tcl_DecrRefCount(valPtr); if (allocateDict) { Tcl_DecrRefCount(dictPtr); } -- cgit v0.12