Fix: Use after free when removing attribute on instances
Assume that only one layer matches the id and return instead of continuing to iterate over attributes after the layers have been potentially reallocated.
This commit is contained in:
parent
80859a6cb2
commit
05715eaea1
|
@ -746,15 +746,14 @@ bool CustomDataAttributes::create_by_move(const AttributeIDRef &attribute_id,
|
|||
|
||||
bool CustomDataAttributes::remove(const AttributeIDRef &attribute_id)
|
||||
{
|
||||
bool result = false;
|
||||
for (const int i : IndexRange(data.totlayer)) {
|
||||
const CustomDataLayer &layer = data.layers[i];
|
||||
if (custom_data_layer_matches_attribute_id(layer, attribute_id)) {
|
||||
CustomData_free_layer(&data, layer.type, size_, i);
|
||||
result = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return false;
|
||||
}
|
||||
|
||||
void CustomDataAttributes::reallocate(const int size)
|
||||
|
|
Loading…
Reference in New Issue