Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-06-22 17:03:27 +0300
committerHans Goudey <h.goudey@me.com>2022-06-22 17:03:27 +0300
commit785931fc3cdbfb46af9c561acf6e281a1574fcee (patch)
treeb553e2e39ea0101022a46ec538f0f087ee1b4e2b /source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
parenta3d0f77ded1c982da93d61fac6942cfc67c9e599 (diff)
Fix: Memory leak writing to builtin attribute with wrong type
The store named attribute node creates a new buffer to evaluate the field into. When creating the attribute with that buffer fails, if must be freed.
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
index 7ccdae2e5a6..abac6d8d6b3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
@@ -118,7 +118,9 @@ static void try_capture_field_on_geometry(GeometryComponent &component,
MEM_freeN(buffer);
}
else {
- component.attribute_try_create(name, domain, data_type, AttributeInitMove{buffer});
+ if (!component.attribute_try_create(name, domain, data_type, AttributeInitMove{buffer})) {
+ MEM_freeN(buffer);
+ }
}
}