summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-11-13 15:23:42 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-11-13 15:23:42 (GMT)
commite38f8275221071a0f0c7ab3dedf264f91f76a5eb (patch)
treea104c06eec6b7205ee06763ccff2e05b434bb4c7
parentfc3971425ebb6b5c78c8300b280560a5d5920388 (diff)
parentd739e9b6a832caa5729f3d77aaf3017b0c1fb867 (diff)
downloadtcl-e38f8275221071a0f0c7ab3dedf264f91f76a5eb.zip
tcl-e38f8275221071a0f0c7ab3dedf264f91f76a5eb.tar.gz
tcl-e38f8275221071a0f0c7ab3dedf264f91f76a5eb.tar.bz2
Plug memory leak. Fork new trunk that isn't broken.
-rw-r--r--generic/tclOO.c9
-rw-r--r--generic/tclOODefineCmds.c2
2 files changed, 9 insertions, 2 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c
index 440f8e4..c87d7bb 100644
--- a/generic/tclOO.c
+++ b/generic/tclOO.c
@@ -1057,7 +1057,6 @@ TclOOReleaseClassContents(
if (IsRootClass(oPtr) && !Deleted(fPtr->objectCls->thisPtr)) {
Tcl_DeleteCommandFromToken(interp, fPtr->objectCls->thisPtr->command);
}
- oPtr->classPtr = NULL;
}
/*
@@ -1183,7 +1182,9 @@ ObjectNamespaceDeleted(
TclOORemoveFromInstances(oPtr, mixinPtr);
TclOODecrRefCount(mixinPtr->thisPtr);
}
- Tcl_Free(oPtr->mixins.list);
+ if (oPtr->mixins.list != NULL) {
+ Tcl_Free(oPtr->mixins.list);
+ }
}
FOREACH(filterObj, oPtr->filters) {
@@ -1384,6 +1385,10 @@ TclOORemoveFromMixins(
break;
}
}
+ if (oPtr->mixins.num == 0) {
+ Tcl_Free(oPtr->mixins.list);
+ oPtr->mixins.list = NULL;
+ }
return res;
}
diff --git a/generic/tclOODefineCmds.c b/generic/tclOODefineCmds.c
index 9d23f8f..3f8d2d6 100644
--- a/generic/tclOODefineCmds.c
+++ b/generic/tclOODefineCmds.c
@@ -1449,6 +1449,8 @@ TclOODefineClassObjCmd(
TclOODeleteDescendants(interp, oPtr);
oPtr->flags &= ~DONT_DELETE;
TclOOReleaseClassContents(interp, oPtr);
+ Tcl_Free(oPtr->classPtr);
+ oPtr->classPtr = NULL;
} else if (!wasClass && willBeClass) {
TclOOAllocClass(interp, oPtr);
}