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

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


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

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 fc7054f675a..846f36ff1a1 100644
--- a/source/blender/python/generic/idprop_py_api.c
+++ b/source/blender/python/generic/idprop_py_api.c
@@ -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;
         }
       }



More information about the Bf-blender-cvs mailing list