Skip to content

Commit

Permalink
Fix leaking of Mesh version and lod memory when freeing mesh in GLES3
Browse files Browse the repository at this point in the history
  • Loading branch information
clayjohn committed Sep 13, 2022
1 parent 22a09fe commit 9f70848
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/gles3/storage/mesh_storage.cpp
Expand Up @@ -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) {
Expand Down

0 comments on commit 9f70848

Please sign in to comment.