diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-09-16 09:38:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-09-16 09:39:42 +0300 |
commit | 0e329a967e8defef7dbaf417f4187e2281123a43 (patch) | |
tree | 38468fbd40b3962e05cdce514887ee4422dbb5d1 /source | |
parent | 0530b679092e44bda2bf67b5096573718d108364 (diff) |
Fix memory leak if an error occurred assigning id-property sequence
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/generic/idprop_py_api.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index 4296474c011..8dc0d2fb857 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -533,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] = PyFloat_AsDouble(item)) == -1.0) && PyErr_Occurred()) { + IDP_FreeProperty(prop); return NULL; } } @@ -545,6 +546,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; } } @@ -555,6 +557,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; } } |