Animation CustomAttributes Causing Memory Leak (5.3)

I’m adding CustomAttributes to an FPoseContext and found that they leak dynamic memory.

TWrappedAttribute calls InitializeStruct on the allocated buffer, but never calls DestroyStruct

If I implement a destructor, the TAttributeContainer becomes the issue, as it doesn’t explicitly implement a move/copy constructor or assignment operator and only properly constructs attributes in CopyFrom.

So I can call CopyFrom directly to solve the issue, but throughout the engine you’ll find references to FPoseContext and attribute containers using the assignment operator.

And yes, one could argue that custom attributes should only store simple data types that fit in the TWrappedAttribute buffer, but since it supports any UStruct, I feel that’s quite limiting.