diff options
author | hobbs <hobbs> | 2000-11-01 21:48:45 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2000-11-01 21:48:45 (GMT) |
commit | 51d45cde58ea58db5d1b872e26b3a031971ea348 (patch) | |
tree | a15be919679243106c161d70106c3b7aca676100 /generic/tclVar.c | |
parent | 35fc87f5267f568abd48f1ac06d90008436b7476 (diff) | |
download | tcl-51d45cde58ea58db5d1b872e26b3a031971ea348.zip tcl-51d45cde58ea58db5d1b872e26b3a031971ea348.tar.gz tcl-51d45cde58ea58db5d1b872e26b3a031971ea348.tar.bz2 |
* generic/tclVar.c (TclVarTraceExists): Corrected excessive mem
use when info exists was called on a non-existent array element.
[BUG: 119213, 119336]
Diffstat (limited to 'generic/tclVar.c')
-rw-r--r-- | generic/tclVar.c | 35 |
1 files 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; } |