[Bf-blender-cvs] [c6856da22c8] blender-v2.83-release: Fix memory leak if an error occurred assigning id-property sequence

Campbell Barton noreply at git.blender.org
Wed Sep 22 08:50:08 CEST 2021


Commit: c6856da22c85d1c9498118121a93548a5b164806
Author: Campbell Barton
Date:   Thu Sep 16 16:38:02 2021 +1000
Branches: blender-v2.83-release
https://developer.blender.org/rBc6856da22c85d1c9498118121a93548a5b164806

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

===================================================================

M	source/blender/python/generic/idprop_py_api.c

===================================================================

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;
         }
       }



More information about the Bf-blender-cvs mailing list