Fix (unreported) memleak when copying object with some modifiers.
This commit is contained in:
parent
f74d85ffc8
commit
c09e22306a
Notes:
blender-bot
2023-12-22 20:14:11 +01:00
Referenced by issue #55000, Crash with hooks and curves in Cycles render
|
@ -286,6 +286,13 @@ void modifiers_foreachTexLink(Object *ob, TexWalkFunc walk, void *userData)
|
|||
void modifier_copyData_generic(const ModifierData *md_src, ModifierData *md_dst)
|
||||
{
|
||||
const ModifierTypeInfo *mti = modifierType_getInfo(md_src->type);
|
||||
|
||||
/* md_dst may have alredy be fully initialized with some extra allocated data,
|
||||
* we need to free it now to avoid memleak. */
|
||||
if (mti->freeData) {
|
||||
mti->freeData(md_dst);
|
||||
}
|
||||
|
||||
const size_t data_size = sizeof(ModifierData);
|
||||
const char *md_src_data = ((const char *)md_src) + data_size;
|
||||
char *md_dst_data = ((char *)md_dst) + data_size;
|
||||
|
|
Loading…
Reference in New Issue