[Bf-blender-cvs] [785931fc3cd] master: Fix: Memory leak writing to builtin attribute with wrong type
Hans Goudey
noreply at git.blender.org
Wed Jun 22 16:06:41 CEST 2022
Commit: 785931fc3cdbfb46af9c561acf6e281a1574fcee
Author: Hans Goudey
Date: Wed Jun 22 09:03:27 2022 -0500
Branches: master
https://developer.blender.org/rB785931fc3cdbfb46af9c561acf6e281a1574fcee
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.
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_store_named_attribute.cc
===================================================================
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);
+ }
}
}
More information about the Bf-blender-cvs
mailing list