Fix T102238: double free when storing attribute on empty geometry
This commit is contained in:
parent
186f16e84c
commit
e031a45d60
Notes:
blender-bot
2023-02-14 06:46:23 +01:00
Referenced by issue #102238, Geometry Node: Memory leak -> EXCEPTION_ACCESS_VIOLATION -> EXCEPTION_INT_DIVIDE_BY_ZERO. Referenced by issue #101972, Regression: GN: Crashes when setting Spline Type from NURBS to Bezier in a row.
|
@ -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)];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue