diff options
author | hobbs <hobbs> | 2002-03-01 06:23:08 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-03-01 06:23:08 (GMT) |
commit | faa0525ea148ed2a99522c3b0bc44da5a4afb6c4 (patch) | |
tree | b49a7122077d01671b7ea1253acf1671f78d4626 | |
parent | f838baaa0a3899303119eec543420e74ef5beac8 (diff) | |
download | tcl-faa0525ea148ed2a99522c3b0bc44da5a4afb6c4.zip tcl-faa0525ea148ed2a99522c3b0bc44da5a4afb6c4.tar.gz tcl-faa0525ea148ed2a99522c3b0bc44da5a4afb6c4.tar.bz2 |
* generic/tclCmdMZ.c (TraceCommandProc): ensure that TraceCommandInfo
structure was also deleted when a command was deleted to prevent a
mem leak.
-rw-r--r-- | generic/tclCmdMZ.c | 8 |
1 files 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; |