From 50928f540511857885e1a13fb17a9d0441346c98 Mon Sep 17 00:00:00 2001 From: Kevin B Kenny Date: Mon, 2 Jun 2008 02:19:40 +0000 Subject: * generic/tclOO.c (ReleaseClassContents): Fix the one remaining valgrind complaint about oo.test, caused by failing to protect the Object as well as the Class corresponding to a subclass being deleted and hence getting a freed-memory read when attempting to delete the class command. [Bug 1981001] --- ChangeLog | 8 ++++++++ generic/tclOO.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bd674eb..bc2e6d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-06-02 Kevin B. Kenny + + * generic/tclOO.c (ReleaseClassContents): Fix the one remaining + valgrind complaint about oo.test, caused by failing to protect + the Object as well as the Class corresponding to a subclass being + deleted and hence getting a freed-memory read when attempting to + delete the class command. [Bug 1981001] + 2008-06-01 Donal K. Fellows * generic/tclOOMethod.c (Tcl_NewMethod): Complete the fix of [Bug diff --git a/generic/tclOO.c b/generic/tclOO.c index ef939e8..f374876 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclOO.c,v 1.6 2008/05/31 23:35:27 das Exp $ + * RCS: @(#) $Id: tclOO.c,v 1.7 2008/06/02 02:19:41 kennykb Exp $ */ #ifdef HAVE_CONFIG_H @@ -618,12 +618,14 @@ ReleaseClassContents( clsPtr->mixinSubs.size = 0; for (i=0 ; ithisPtr); } for (i=0 ; ithisPtr->flags & OBJECT_DELETED)) { list[i]->thisPtr->flags |= OBJECT_DELETED; Tcl_DeleteCommandFromToken(interp, list[i]->thisPtr->command); } + DelRef(list[i]->thisPtr); DelRef(list[i]); } if (list != NULL) { @@ -637,12 +639,14 @@ ReleaseClassContents( clsPtr->subclasses.size = 0; for (i=0 ; ithisPtr); } for (i=0 ; ithisPtr->flags & OBJECT_DELETED)) { list[i]->thisPtr->flags |= OBJECT_DELETED; Tcl_DeleteCommandFromToken(interp, list[i]->thisPtr->command); } + DelRef(list[i]->thisPtr); DelRef(list[i]); } if (list != NULL) { -- cgit v0.12