浏览代码

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 月之前
父节点
当前提交
2194944a25
共有 1 个文件被更改,包括 1 次插入0 次删除
  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();
     }