Fix missing call to PyObject_GC_UnTrack WITH_PYTHON_SECURITY

Untrack all newly created objects, although this code-path only runs
when creating the type fails - which is an exceptional case.
This commit is contained in:
Campbell Barton
2024-03-12 16:29:46 +11:00
parent 4b7cc5b660
commit 658ef7c730

View File

@@ -7654,6 +7654,12 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr)
pyrna = (BPy_StructRNA *)PyObject_New(BPy_StructRNA, &pyrna_struct_Type);
#endif
#ifdef USE_PYRNA_STRUCT_REFERENCE
/* #PyType_GenericAlloc will have set tracking.
* We only want tracking when `StructRNA.reference` has been set. */
PyObject_GC_UnTrack(pyrna);
#endif
#ifdef USE_WEAKREFS
if (pyrna != nullptr) {
pyrna->in_weakreflist = nullptr;