Index: generic/tclVar.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclVar.c,v
retrieving revision 1.41
diff -u -r1.41 tclVar.c
--- generic/tclVar.c	2001/11/19 14:35:54	1.41
+++ generic/tclVar.c	2001/11/21 20:13:33
@@ -2374,7 +2374,7 @@
 	while (dummyVar.tracePtr != NULL) {
 	    VarTrace *tracePtr = dummyVar.tracePtr;
 	    dummyVar.tracePtr = tracePtr->nextPtr;
-	    ckfree((char *) tracePtr);
+	    Tcl_EventuallyFree((ClientData) tracePtr, TCL_DYNAMIC);
 	}
 	for (activePtr = iPtr->activeTracePtr;  activePtr != NULL;
 	     activePtr = activePtr->nextPtr) {
@@ -2695,7 +2695,7 @@
     } else {
 	prevPtr->nextPtr = tracePtr->nextPtr;
     }
-    ckfree((char *) tracePtr);
+    Tcl_EventuallyFree((ClientData) tracePtr, TCL_DYNAMIC);
 
     /*
      * If this is the last trace on the variable, and the variable is
@@ -4495,6 +4495,7 @@
     result = NULL;
     active.nextPtr = iPtr->activeTracePtr;
     iPtr->activeTracePtr = &active;
+    Tcl_Preserve((ClientData) iPtr);
     if (arrayPtr != NULL && !(arrayPtr->flags & VAR_TRACE_ACTIVE)) {
 	arrayPtr->refCount++;
 	active.varPtr = arrayPtr;
@@ -4504,6 +4505,7 @@
 	    if (!(tracePtr->flags & flags)) {
 		continue;
 	    }
+	    Tcl_Preserve((ClientData) tracePtr);
 	    result = (*tracePtr->traceProc)(tracePtr->clientData,
 		    (Tcl_Interp *) iPtr, part1, part2, flags);
 	    if (result != NULL) {
@@ -4517,9 +4519,11 @@
 		    }
 		    result = NULL;
 		} else {
+	            Tcl_Release((ClientData) tracePtr);
 		    goto done;
 		}
 	    }
+	    Tcl_Release((ClientData) tracePtr);
 	}
     }
 
@@ -4537,6 +4541,7 @@
 	if (!(tracePtr->flags & flags)) {
 	    continue;
 	}
+	Tcl_Preserve((ClientData) tracePtr);
 	result = (*tracePtr->traceProc)(tracePtr->clientData,
 		(Tcl_Interp *) iPtr, part1, part2, flags);
 	if (result != NULL) {
@@ -4550,9 +4555,11 @@
 		}
 		result = NULL;
 	    } else {
+	        Tcl_Release((ClientData) tracePtr);
 		goto done;
 	    }
 	}
+	Tcl_Release((ClientData) tracePtr);
     }
 
     /*
@@ -4570,6 +4577,7 @@
     varPtr->flags &= ~VAR_TRACE_ACTIVE;
     varPtr->refCount--;
     iPtr->activeTracePtr = active.nextPtr;
+    Tcl_Release((ClientData) iPtr);
     return result;
 }
 
@@ -4894,7 +4902,7 @@
 	    while (varPtr->tracePtr != NULL) {
 		VarTrace *tracePtr = varPtr->tracePtr;
 		varPtr->tracePtr = tracePtr->nextPtr;
-		ckfree((char *) tracePtr);
+		Tcl_EventuallyFree((ClientData) tracePtr, TCL_DYNAMIC);
 	    }
 	    for (activePtr = iPtr->activeTracePtr; activePtr != NULL;
 		 activePtr = activePtr->nextPtr) {
@@ -5028,7 +5036,7 @@
 	    while (varPtr->tracePtr != NULL) {
 		VarTrace *tracePtr = varPtr->tracePtr;
 		varPtr->tracePtr = tracePtr->nextPtr;
-		ckfree((char *) tracePtr);
+		Tcl_EventuallyFree((ClientData) tracePtr, TCL_DYNAMIC);
 	    }
 	    for (activePtr = iPtr->activeTracePtr; activePtr != NULL;
 		 activePtr = activePtr->nextPtr) {
@@ -5127,7 +5135,7 @@
 	    while (elPtr->tracePtr != NULL) {
 		VarTrace *tracePtr = elPtr->tracePtr;
 		elPtr->tracePtr = tracePtr->nextPtr;
-		ckfree((char *) tracePtr);
+		Tcl_EventuallyFree((ClientData) tracePtr,TCL_DYNAMIC);
 	    }
 	    for (activePtr = iPtr->activeTracePtr; activePtr != NULL;
 		 activePtr = activePtr->nextPtr) {
