diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-09-16 09:38:02 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-09-22 09:49:30 +0300 |
commit | c6856da22c85d1c9498118121a93548a5b164806 (patch) | |
tree | b4e5e5d1bd0fee1976e2b2ebc9d552610f51c9b7 | |
parent | 5f156291cdcccba300866e89ef35837093ba52f9 (diff) |
Fix memory leak if an error occurred assigning id-property sequence
-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 bd86df80e52..20995e48b65 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -519,6 +519,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; } } @@ -531,6 +532,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; } } @@ -541,6 +543,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; } } |