summaryrefslogtreecommitdiffstats
path: root/generic/tclOO.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2024-08-06 11:15:29 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2024-08-06 11:15:29 (GMT)
commitd067bc4e9d912461ed88f970f84183f2ae046b81 (patch)
tree10b477c4f96989d84a5453310c9715aaef2b3413 /generic/tclOO.c
parentdf19b3581f7a45b260c626d77a2d6ca7d3363360 (diff)
parent5b8e7ab89dcc095ee37af0178bbdd5805feb0fcf (diff)
downloadtcl-d067bc4e9d912461ed88f970f84183f2ae046b81.zip
tcl-d067bc4e9d912461ed88f970f84183f2ae046b81.tar.gz
tcl-d067bc4e9d912461ed88f970f84183f2ae046b81.tar.bz2
Force named namespaces to be made by TclOO. [154f0982f2]
Diffstat (limited to 'generic/tclOO.c')
-rw-r--r--generic/tclOO.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/generic/tclOO.c b/generic/tclOO.c
index a7aeeeb..2765676 100644
--- a/generic/tclOO.c
+++ b/generic/tclOO.c
@@ -610,6 +610,10 @@ KillFoundation(
* call TclOOAddToSubclasses() to add it to the right class's list of
* subclasses.
*
+ * Returns:
+ * Pointer to the object structure created, or NULL if a specific
+ * namespace was asked for but couldn't be created.
+ *
* ----------------------------------------------------------------------
*/
@@ -652,11 +656,16 @@ AllocObject(
if (nsNameStr != NULL) {
oPtr->namespacePtr = Tcl_CreateNamespace(interp, nsNameStr, oPtr, NULL);
- if (oPtr->namespacePtr != NULL) {
- creationEpoch = ++fPtr->tsdPtr->nsCount;
- goto configNamespace;
+ if (oPtr->namespacePtr == NULL) {
+ /*
+ * Couldn't make the specific namespace. Report as an error.
+ * [Bug 154f0982f2]
+ */
+ ckfree(oPtr);
+ return NULL;
}
- Tcl_ResetResult(interp);
+ creationEpoch = ++fPtr->tsdPtr->nsCount;
+ goto configNamespace;
}
while (1) {
@@ -1783,6 +1792,9 @@ TclNewObjectInstanceCommon(
*/
oPtr = AllocObject(interp, simpleName, nsPtr, nsNameStr);
+ if (oPtr == NULL) {
+ return NULL;
+ }
oPtr->selfCls = classPtr;
AddRef(classPtr->thisPtr);
TclOOAddToInstances(oPtr, classPtr);