Fix: Fix leak when sortbyp failes with exception (#6166)

Co-authored-by: Kim Kulling <kim.kulling@draeger.com>
This commit is contained in:
Kim Kulling
2025-05-14 11:43:12 +02:00
committed by GitHub
co-authored by Kim Kulling
parent 64073458bd
commit 9d9a80739d
4 changed files with 14 additions and 3 deletions
@@ -136,6 +136,9 @@ void SortByPTypeProcess::Execute(aiScene *pScene) {
for (unsigned int i = 0; i < pScene->mNumMeshes; ++i) {
aiMesh *const mesh = pScene->mMeshes[i];
if (mesh->mPrimitiveTypes == 0) {
for (size_t idx = 0; idx < outMeshes.size(); ++idx) {
delete outMeshes[idx];
}
throw DeadlyImportError("Mesh with invalid primitive type: ", mesh->mName.C_Str());
}