summaryrefslogtreecommitdiff
path: root/drivers/gles3
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-09-13 23:56:53 +0200
committerGitHub <noreply@github.com>2022-09-13 23:56:53 +0200
commit2e6ba5ff13d6e044b2b06cc5e8c7d9a522852525 (patch)
tree5b600404d41801358bf813efe18cfd86a523993e /drivers/gles3
parenteb4ac38fcd9d926bee407443d7dab1e9eb793130 (diff)
parent9f708489fadfa6c738a78bc2045fe1a2ceda0299 (diff)
Merge pull request #65746 from clayjohn/GLES3-mem-leak
Fix leaking of Mesh version and lod memory when freeing mesh in GLES3
Diffstat (limited to 'drivers/gles3')
-rw-r--r--drivers/gles3/storage/mesh_storage.cpp15
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) {