Fix T102238: double free when storing attribute on empty geometry
This commit is contained in:
@@ -247,11 +247,8 @@ static bool add_custom_data_layer_from_attribute_init(const AttributeIDRef &attr
|
||||
}
|
||||
case AttributeInit::Type::MoveArray: {
|
||||
void *source_data = static_cast<const AttributeInitMoveArray &>(initializer).data;
|
||||
void *data = add_generic_custom_data_layer(
|
||||
add_generic_custom_data_layer(
|
||||
custom_data, data_type, CD_ASSIGN, source_data, domain_num, attribute_id);
|
||||
if (source_data != nullptr && data == nullptr) {
|
||||
MEM_freeN(source_data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2800,6 +2800,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
|
||||
int flag = 0;
|
||||
|
||||
if (!typeInfo->defaultname && CustomData_has_layer(data, type)) {
|
||||
MEM_SAFE_FREE(layerdata);
|
||||
return &data->layers[CustomData_get_layer_index(data, type)];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user