2
0
Эх сурвалжийг харах

Potential fix for code scanning alert no. 63: Potential use after free (#6050)

- Ensure that code scanner will identify pointer as already released.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Kim Kulling 6 сар өмнө
parent
commit
2194944a25

+ 1 - 0
code/AssetLib/glTF/glTFImporter.cpp

@@ -153,6 +153,7 @@ void glTFImporter::ImportMaterials(Asset &r) {
         mScene->mNumMaterials = 1;
         // Delete the array of length zero created above.
         delete[] mScene->mMaterials;
+        mScene->mMaterials = nullptr;
         mScene->mMaterials = new aiMaterial *[1];
         mScene->mMaterials[0] = new aiMaterial();
     }