diff options
author | dgp <dgp@users.sourceforge.net> | 2018-11-02 17:18:57 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2018-11-02 17:18:57 (GMT) |
commit | e2d299f77176b587e8995a54587bddf210af6560 (patch) | |
tree | 29b1c8abd99f4cdccd45d8d885ffbeaf80919fbc /generic/tclOO.c | |
parent | 2577d3bd45bdf3d447208afa35b8610bd48d0674 (diff) | |
download | tcl-e2d299f77176b587e8995a54587bddf210af6560.zip tcl-e2d299f77176b587e8995a54587bddf210af6560.tar.gz tcl-e2d299f77176b587e8995a54587bddf210af6560.tar.bz2 |
Fixed memory leak in TclOO.c:ObjectNamespaceDeleted, object mixins and
object/class mutation.
Diffstat (limited to 'generic/tclOO.c')
-rw-r--r-- | generic/tclOO.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c index 573df3e..39d3806 100644 --- a/generic/tclOO.c +++ b/generic/tclOO.c @@ -1035,7 +1035,6 @@ TclOOReleaseClassContents( if (IsRootClass(oPtr) && !Deleted(fPtr->objectCls->thisPtr)) { Tcl_DeleteCommandFromToken(interp, fPtr->objectCls->thisPtr->command); } - oPtr->classPtr = NULL; } /* @@ -1149,7 +1148,9 @@ ObjectNamespaceDeleted( TclOORemoveFromInstances(oPtr, mixinPtr); TclOODecrRefCount(mixinPtr->thisPtr); } - ckfree(oPtr->mixins.list); + if (oPtr->mixins.list != NULL) { + ckfree(oPtr->mixins.list); + } } FOREACH(filterObj, oPtr->filters) { @@ -1350,6 +1351,10 @@ TclOORemoveFromMixins( break; } } + if (oPtr->mixins.num == 0) { + ckfree(oPtr->mixins.list); + oPtr->mixins.list = NULL; + } return res; } |