From dbcc758ef4555aa231333df80d7d865f6131b6d3 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Sun, 11 Jul 2004 21:56:01 +0000 Subject: * generic/tclExecute.c (TEBC): fixed leak of expandNestList objs when there is an error while an expansion is in progress (code added at checkForCatch). --- ChangeLog | 6 ++++++ generic/tclExecute.c | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 635c5c0..0d51767 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-07-11 Miguel Sofer + + * generic/tclExecute.c (TEBC): fixed leak of expandNestList objs + when there is an error while an expansion is in progress (code + added at checkForCatch). + 2004-07-11 Vince Darley * generic/tclIOUtil.c: fix to 'cd' bug when vfs is active diff --git a/generic/tclExecute.c b/generic/tclExecute.c index 46dab96..efbea33 100644 --- a/generic/tclExecute.c +++ b/generic/tclExecute.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: tclExecute.c,v 1.144 2004/07/03 21:36:33 msofer Exp $ + * RCS: @(#) $Id: tclExecute.c,v 1.145 2004/07/11 21:56:01 msofer Exp $ */ #ifdef STDC_HEADERS @@ -4781,6 +4781,20 @@ TclExecuteByteCode(interp, codePtr) iPtr->flags |= ERR_ALREADY_LOGGED; } } + + /* + * Clear all expansions that may have started after the last + * INST_BEGIN_CATCH. + */ + + while ((expandNestList != NULL) && ((catchTop == initCatchTop) || + ((ptrdiff_t) eePtr->stackPtr[catchTop] <= + (ptrdiff_t) expandNestList->internalRep.twoPtrValue.ptr1))) { + Tcl_Obj *objPtr = expandNestList->internalRep.twoPtrValue.ptr2; + TclDecrRefCount(expandNestList); + expandNestList = objPtr; + } + /* * We must not catch an exceeded limit. Instead, it blows * outwards until we either hit another interpreter (presumably -- cgit v0.12