diff options
author | clayjohn <claynjohn@gmail.com> | 2022-09-13 08:19:14 -0700 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2022-09-13 08:19:14 -0700 |
commit | 9f708489fadfa6c738a78bc2045fe1a2ceda0299 (patch) | |
tree | ea861f547e8ce94d1798d95237e46dce04fa8d09 /drivers/gles3/storage/mesh_storage.cpp | |
parent | 22a09fef5d56fc7c37d70118532509076ebd7b12 (diff) |
Fix leaking of Mesh version and lod memory when freeing mesh in GLES3
Diffstat (limited to 'drivers/gles3/storage/mesh_storage.cpp')
-rw-r--r-- | drivers/gles3/storage/mesh_storage.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/gles3/storage/mesh_storage.cpp b/drivers/gles3/storage/mesh_storage.cpp index e54ecd51c4..22d84eba93 100644 --- a/drivers/gles3/storage/mesh_storage.cpp +++ b/drivers/gles3/storage/mesh_storage.cpp @@ -554,6 +554,21 @@ void MeshStorage::mesh_clear(RID p_mesh) { glDeleteBuffers(1, &s.index_buffer); s.index_buffer = 0; } + + if (s.versions) { + memfree(s.versions); //reallocs, so free with memfree. + } + + if (s.lod_count) { + for (uint32_t j = 0; j < s.lod_count; j++) { + if (s.lods[j].index_buffer != 0) { + glDeleteBuffers(1, &s.lods[j].index_buffer); + s.lods[j].index_buffer = 0; + } + } + memdelete_arr(s.lods); + } + memdelete(mesh->surfaces[i]); } if (mesh->surfaces) { |