Prechádzať zdrojové kódy

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 mesiacov pred
rodič
commit
2194944a25
1 zmenil súbory, kde vykonal 1 pridanie a 0 odobranie
  1. 1 0
      code/AssetLib/glTF/glTFImporter.cpp

+ 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();
     }