Fix memory leak if an error occurred assigning id-property sequence

This commit is contained in:
Campbell Barton 2021-09-16 16:38:02 +10:00 committed by Jeroen Bakker
parent e90aabdebf
commit ec448d5a6a
Notes: blender-bot 2023-02-14 04:46:12 +01:00
Referenced by issue #88449: Blender LTS: Maintenance Task 2.93
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
1 changed files with 3 additions and 0 deletions

View File

@ -520,6 +520,7 @@ static IDProperty *idp_from_PySequence_Fast(const char *name, PyObject *ob)
for (i = 0; i < val.array.len; i++) {
item = ob_seq_fast_items[i];
if (((prop_data[i] = PyFloat_AsDouble(item)) == -1.0) && PyErr_Occurred()) {
IDP_FreeProperty(prop);
return NULL;
}
}
@ -532,6 +533,7 @@ static IDProperty *idp_from_PySequence_Fast(const char *name, PyObject *ob)
for (i = 0; i < val.array.len; i++) {
item = ob_seq_fast_items[i];
if (((prop_data[i] = PyC_Long_AsI32(item)) == -1) && PyErr_Occurred()) {
IDP_FreeProperty(prop);
return NULL;
}
}
@ -542,6 +544,7 @@ static IDProperty *idp_from_PySequence_Fast(const char *name, PyObject *ob)
for (i = 0; i < val.array.len; i++) {
item = ob_seq_fast_items[i];
if (BPy_IDProperty_Map_ValidateAndCreate(NULL, prop, item) == false) {
IDP_FreeProperty(prop);
return NULL;
}
}