From e1bb8afe489c46336d1fbc4a223e26a9b3979121 Mon Sep 17 00:00:00 2001 From: Miguel Sofer Date: Thu, 28 Jun 2007 13:56:20 +0000 Subject: * generic/tclVar.c (UnsetVarStruct): fix possible segfault with recent streamlining. --- ChangeLog | 4 ++++ generic/tclVar.c | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f5eeeb1..770d7fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-06-28 Miguel Sofer + + * generic/tclVar.c (UnsetVarStruct): fix possible segfault. + 2007-06-27 Don Porter * generic/tclTrace.c: Corrected broken trace reversal logic in diff --git a/generic/tclVar.c b/generic/tclVar.c index d6049e9..b0036d5 100644 --- a/generic/tclVar.c +++ b/generic/tclVar.c @@ -15,7 +15,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.143 2007/06/26 13:34:36 msofer Exp $ + * RCS: @(#) $Id: tclVar.c,v 1.144 2007/06/28 13:56:21 msofer Exp $ */ #include "tclInt.h" @@ -2140,6 +2140,7 @@ UnsetVarStruct( } if (part1Ptr) { Tcl_DecrRefCount(part1Ptr); + part1 = NULL; } } @@ -2171,10 +2172,10 @@ UnsetVarStruct( } else if (TclIsVarArray(dummyVarPtr) && !TclIsVarUndefined(dummyVarPtr)) { /* * If the variable is an array, delete all of its elements. This must - * be done after calling the traces on the array, above (that's the - * way traces are defined). If the array is traced, its name is - * already in part1. If not, and the name is required for some - * element, it will be computed at DeleteArray. + * be done after calling and deleting the traces on the array, above + * (that's the way traces are defined). If the array name is not + * present and is required for a trace on some element, it will be + * computed at DeleteArray. */ DeleteArray(iPtr, part1, dummyVarPtr, (flags -- cgit v0.12