From 1f209bfc41ef5f2cd63c961262d5d6fe3e03b55a Mon Sep 17 00:00:00 2001 From: qarmin Date: Mon, 2 Mar 2020 19:17:20 +0100 Subject: Fixes bugs found by Sonarcloud and Coverity --- servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp | 2 +- servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'servers/visual/rasterizer_rd') diff --git a/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp index f4d59e9e54..01cab76128 100644 --- a/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_effects_rd.cpp @@ -1077,7 +1077,7 @@ RasterizerEffectsRD::~RasterizerEffectsRD() { RD::get_singleton()->free(filter.image_uniform_set); } - if (RD::get_singleton()->uniform_set_is_valid(filter.image_uniform_set)) { + if (RD::get_singleton()->uniform_set_is_valid(filter.uniform_set)) { RD::get_singleton()->free(filter.uniform_set); } diff --git a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp b/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp index 15cbc61b76..52cefa7511 100644 --- a/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp +++ b/servers/visual/rasterizer_rd/rasterizer_storage_rd.cpp @@ -1906,8 +1906,10 @@ void RasterizerStorageRD::mesh_add_surface(RID p_mesh, const VS::SurfaceData &p_ for (int i = 0; i < p_surface.blend_shapes.size(); i++) { - ERR_FAIL_COND(p_surface.blend_shapes[i].size() != p_surface.vertex_data.size()); - + if (p_surface.blend_shapes[i].size() != p_surface.vertex_data.size()) { + memdelete(s); + ERR_FAIL_COND(p_surface.blend_shapes[i].size() != p_surface.vertex_data.size()); + } RID vertex_buffer = RD::get_singleton()->vertex_buffer_create(p_surface.blend_shapes[i].size(), p_surface.blend_shapes[i]); s->blend_shapes.push_back(vertex_buffer); } -- cgit v1.2.3