Merge pull request #2717 from migenius/migenius-fix-doublefree
Fix multiple deallocation of memory for texture data.pull/2725/head^2
commit
2ed0d905ab
|
@ -320,7 +320,9 @@ void glTF2Exporter::GetMatTex(const aiMaterial* mat, Ref<Texture>& texture, aiTe
|
||||||
if (path[0] == '*') { // embedded
|
if (path[0] == '*') { // embedded
|
||||||
aiTexture* tex = mScene->mTextures[atoi(&path[1])];
|
aiTexture* tex = mScene->mTextures[atoi(&path[1])];
|
||||||
|
|
||||||
uint8_t* data = reinterpret_cast<uint8_t*>(tex->pcData);
|
// copy data since lifetime control is handed over to the asset
|
||||||
|
uint8_t* data = new uint8_t[tex->mWidth];
|
||||||
|
memcpy(data, tex->pcData, tex->mWidth);
|
||||||
texture->source->SetData(data, tex->mWidth, *mAsset);
|
texture->source->SetData(data, tex->mWidth, *mAsset);
|
||||||
|
|
||||||
if (tex->achFormatHint[0]) {
|
if (tex->achFormatHint[0]) {
|
||||||
|
|
Loading…
Reference in New Issue