summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaoyu Qiu <timothyqiu32@gmail.com>2020-02-15 13:45:17 +0800
committerHaoyu Qiu <timothyqiu32@gmail.com>2020-02-15 14:25:32 +0800
commitd9b5cbdffa80af3fd04ec9d71c98f0845733eac7 (patch)
tree74c7ee914a3327ac6c50967ac99f197be0ecdb3a
parent7724b842f61e570fcfb1254b12df8c9dc30375c6 (diff)
Fixes memory leaks in GdNavigationServer and RasterizerSceneHighEndRD
-rw-r--r--modules/gdnavigation/gd_navigation_server.cpp9
-rw-r--r--servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp12
2 files changed, 18 insertions, 3 deletions
diff --git a/modules/gdnavigation/gd_navigation_server.cpp b/modules/gdnavigation/gd_navigation_server.cpp
index 2780e2a931..5bafa5507c 100644
--- a/modules/gdnavigation/gd_navigation_server.cpp
+++ b/modules/gdnavigation/gd_navigation_server.cpp
@@ -115,12 +115,15 @@
GdNavigationServer::GdNavigationServer() :
NavigationServer(),
+ commands_mutex(Mutex::create()),
+ operations_mutex(Mutex::create()),
active(true) {
- commands_mutex = Mutex::create();
- operations_mutex = Mutex::create();
}
-GdNavigationServer::~GdNavigationServer() {}
+GdNavigationServer::~GdNavigationServer() {
+ memdelete(operations_mutex);
+ memdelete(commands_mutex);
+}
void GdNavigationServer::add_command(SetCommand *command) const {
auto mut_this = const_cast<GdNavigationServer *>(this);
diff --git a/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
index e3c3cdf0bf..d329fa5779 100644
--- a/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
+++ b/servers/visual/rasterizer_rd/rasterizer_scene_high_end_rd.cpp
@@ -2697,8 +2697,20 @@ RasterizerSceneHighEndRD::~RasterizerSceneHighEndRD() {
RD::get_singleton()->free(view_dependant_uniform_set);
}
+ storage->free(wireframe_material_shader);
+ storage->free(overdraw_material_shader);
+ storage->free(default_shader);
+
+ storage->free(wireframe_material);
+ storage->free(overdraw_material);
+ storage->free(default_material);
+
{
RD::get_singleton()->free(scene_state.reflection_buffer);
+ memdelete_arr(scene_state.instances);
+ memdelete_arr(scene_state.gi_probes);
+ memdelete_arr(scene_state.directional_lights);
+ memdelete_arr(scene_state.lights);
memdelete_arr(scene_state.reflections);
}
}