From f0fce3b27df91a506d77ccc5bfec17437a6f079e Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Sat, 4 Nov 2006 00:09:33 +0000 Subject: * generic/tclBasic.c (TEOVI): fix por possible leak of a Command in the presence of execution traces that delete it. --- ChangeLog | 3 +++ generic/tclBasic.c | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3250cd..3883a50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-11-03 Miguel Sofer + * generic/tclBasic.c (TEOVI): fix por possible leak of a Command + in the presence of execution traces that delete it. + * generic/tclBasic.c (TEOVI): * tests/trace.test (trace-21.11): fix for [Bug 1590232], execution traces may cause a second command resolution in the wrong diff --git a/generic/tclBasic.c b/generic/tclBasic.c index 0f5c535..40cc7fb 100644 --- a/generic/tclBasic.c +++ b/generic/tclBasic.c @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclBasic.c,v 1.215 2006/11/03 23:24:43 msofer Exp $ + * RCS: @(#) $Id: tclBasic.c,v 1.216 2006/11/04 00:09:33 msofer Exp $ */ #include "tclInt.h" @@ -3418,6 +3418,7 @@ TclEvalObjvInternal( if (checkTraces && (command != NULL)) { int cmdEpoch = cmdPtr->cmdEpoch; + int newEpoch; /* * Execute any command or execution traces. Note that we bump up the @@ -3434,7 +3435,8 @@ TclEvalObjvInternal( traceCode = TclCheckExecutionTraces(interp, command, length, cmdPtr, code, TCL_TRACE_ENTER_EXEC, objc, objv); } - cmdPtr->refCount--; + newEpoch = cmdPtr->cmdEpoch; + TclCleanupCommand(cmdPtr); /* * If the traces modified/deleted the command or any existing traces, @@ -3444,7 +3446,7 @@ TclEvalObjvInternal( * implementation. */ - if (cmdEpoch != cmdPtr->cmdEpoch) { + if (cmdEpoch != newEpoch) { checkTraces = 0; goto reparseBecauseOfTraces; } -- cgit v0.12