From 51d45cde58ea58db5d1b872e26b3a031971ea348 Mon Sep 17 00:00:00 2001 From: hobbs Date: Wed, 1 Nov 2000 21:48:45 +0000 Subject: * generic/tclVar.c (TclVarTraceExists): Corrected excessive mem use when info exists was called on a non-existent array element. [BUG: 119213, 119336] --- generic/tclVar.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/generic/tclVar.c b/generic/tclVar.c index b8a0271..53a8f6c 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.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: tclVar.c,v 1.23 2000/08/25 20:39:31 ericm Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.24 2000/11/01 21:48:45 hobbs Exp $ */ #include "tclInt.h" @@ -4863,7 +4863,6 @@ TclVarTraceExists(interp, varName) { Var *varPtr; Var *arrayPtr; - char *msg; /* * The choice of "create" flag values is delicate here, and @@ -4876,27 +4875,27 @@ TclVarTraceExists(interp, varName) */ varPtr = TclLookupVar(interp, varName, (char *) NULL, - 0, "access", - /*createPart1*/ 0, /*createPart2*/ 1, &arrayPtr); + 0, "access", /*createPart1*/ 0, /*createPart2*/ 1, &arrayPtr); + if (varPtr == NULL) { return NULL; } - if ((varPtr != NULL) && - ((varPtr->tracePtr != NULL) - || ((arrayPtr != NULL) && (arrayPtr->tracePtr != NULL)))) { - msg = CallTraces((Interp *)interp, arrayPtr, varPtr, varName, + + if ((varPtr->tracePtr != NULL) + || ((arrayPtr != NULL) && (arrayPtr->tracePtr != NULL))) { + CallTraces((Interp *)interp, arrayPtr, varPtr, varName, (char *) NULL, TCL_TRACE_READS); - if (msg != NULL) { - /* - * If the variable doesn't exist anymore and no-one's using - * it, then free up the relevant structures and hash table entries. - */ + } - if (TclIsVarUndefined(varPtr)) { - CleanupVar(varPtr, arrayPtr); - } - return NULL; - } + /* + * If the variable doesn't exist anymore and no-one's using + * it, then free up the relevant structures and hash table entries. + */ + + if (TclIsVarUndefined(varPtr)) { + CleanupVar(varPtr, arrayPtr); + return NULL; } + return varPtr; } -- cgit v0.12