Fix memory leak in IDPropertyGroup.pop()

When popping ID-property groups/arrays,
ID-property was removed but not freed.

Now the value is converted to a native Python type and freed.
This commit is contained in:
2021-05-14 19:18:50 +10:00
parent fce795415a
commit 3c09beb3b1
4 changed files with 13 additions and 7 deletions

View File

@@ -5006,8 +5006,13 @@ static PyObject *pyrna_struct_pop(BPy_StructRNA *self, PyObject *args)
idprop = IDP_GetPropertyFromGroup(group, key);
if (idprop) {
PyObject *ret = BPy_IDGroup_WrapData(self->ptr.owner_id, idprop, group);
IDP_RemoveFromGroup(group, idprop);
/* Don't use #BPy_IDGroup_WrapData as the id-property is being removed from the ID. */
PyObject *ret = BPy_IDGroup_MapDataToPy(idprop);
/* Internal error. */
if (UNLIKELY(ret == NULL)) {
return NULL;
}
IDP_FreeFromGroup(group, idprop);
return ret;
}
}