diff --git a/include/assimp/metadata.h b/include/assimp/metadata.h index cd7569ffe..3a50e3b58 100644 --- a/include/assimp/metadata.h +++ b/include/assimp/metadata.h @@ -313,8 +313,13 @@ struct aiMetadata { // Set metadata type mValues[index].mType = GetAiType(value); + // Copy the given value to the dynamic storage - mValues[index].mData = new T(value); + if (nullptr != mValues[index].mData) { + ::memcpy(mValues[index].mData, &value, sizeof(T)); + } else { + mValues[index].mData = new T(value); + } return true; }