diff options
author | kennykb <kennykb@noemail.net> | 2008-06-02 02:19:40 (GMT) |
---|---|---|
committer | kennykb <kennykb@noemail.net> | 2008-06-02 02:19:40 (GMT) |
commit | 13f07cad72cd7ea6f222900cd93fc980b9c16026 (patch) | |
tree | ea58882d583beb270cd19a06b1fea4d4b11ad6f6 /generic/tclOO.c | |
parent | 6ac5142046c271616525ca7ed34d3fb8f015b5a6 (diff) | |
download | tcl-13f07cad72cd7ea6f222900cd93fc980b9c16026.zip tcl-13f07cad72cd7ea6f222900cd93fc980b9c16026.tar.gz tcl-13f07cad72cd7ea6f222900cd93fc980b9c16026.tar.bz2 |
* 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]
FossilOrigin-Name: 9188c64990785af62fd9e6a80d24232aea893581
Diffstat (limited to 'generic/tclOO.c')
-rw-r--r-- | generic/tclOO.c | 6 |
1 files changed, 5 insertions, 1 deletions
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 ; i<n ; i++) { AddRef(list[i]); + AddRef(list[i]->thisPtr); } for (i=0 ; i<n ; i++) { if (!(list[i]->thisPtr->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 ; i<n ; i++) { AddRef(list[i]); + AddRef(list[i]->thisPtr); } for (i=0 ; i<n ; i++) { if (!(list[i]->thisPtr->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) { |