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.
This commit is contained in:
Hans Goudey
2022-06-22 09:03:27 -05:00
parent a3d0f77ded
commit 785931fc3c

View File

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