From faa0525ea148ed2a99522c3b0bc44da5a4afb6c4 Mon Sep 17 00:00:00 2001 From: hobbs Date: Fri, 1 Mar 2002 06:23:08 +0000 Subject: * generic/tclCmdMZ.c (TraceCommandProc): ensure that TraceCommandInfo structure was also deleted when a command was deleted to prevent a mem leak. --- generic/tclCmdMZ.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/generic/tclCmdMZ.c b/generic/tclCmdMZ.c index d78e29c..ef96e0c 100644 --- a/generic/tclCmdMZ.c +++ b/generic/tclCmdMZ.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdMZ.c,v 1.62 2002/02/27 06:39:26 hobbs Exp $ + * RCS: @(#) $Id: tclCmdMZ.c,v 1.63 2002/03/01 06:23:08 hobbs Exp $ */ #include "tclInt.h" @@ -3688,7 +3688,11 @@ TraceCommandProc(clientData, interp, oldName, newName, flags) Tcl_DStringFree(&cmd); } - if (flags & TCL_TRACE_DESTROYED) { + /* + * We delete when the trace was destroyed or if this is a delete trace, + * because command deletes are unconditional, so the trace must go away. + */ + if (flags & (TCL_TRACE_DESTROYED | TCL_TRACE_DELETE)) { ckfree((char *) tcmdPtr); } return; -- cgit v0.12