aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBřetislav Štec <valsiterb@gmail.com>2015-08-02 00:16:31 +0200
committerkwolekr <kwolekr@minetest.net>2015-08-02 02:16:30 -0400
commitc4287a0d681abd4728f978d2ac55285cf6a6ecad (patch)
treedcb484ceedc51eb113649e0b8cec962045f3586a /src
parentebe7b31538d44277db0eeccfddef13917baa2ee7 (diff)
downloadminetest-c4287a0d681abd4728f978d2ac55285cf6a6ecad.tar.gz
minetest-c4287a0d681abd4728f978d2ac55285cf6a6ecad.tar.bz2
minetest-c4287a0d681abd4728f978d2ac55285cf6a6ecad.zip
src/wieldmesh.cpp: Fix mesh extrusion memory leak
Diffstat (limited to 'src')
-rw-r--r--src/wieldmesh.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/wieldmesh.cpp b/src/wieldmesh.cpp
index 56c84b959..391a456ab 100644
--- a/src/wieldmesh.cpp
+++ b/src/wieldmesh.cpp
@@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define MIN_EXTRUSION_MESH_RESOLUTION 16
#define MAX_EXTRUSION_MESH_RESOLUTION 512
-static scene::IMesh* createExtrusionMesh(int resolution_x, int resolution_y)
+static scene::IMesh *createExtrusionMesh(int resolution_x, int resolution_y)
{
const f32 r = 0.5;
@@ -114,8 +114,9 @@ static scene::IMesh* createExtrusionMesh(int resolution_x, int resolution_y)
mesh->addMeshBuffer(buf);
buf->drop();
scaleMesh(mesh, scale); // also recalculates bounding box
- mesh = (scene::SMesh *)createForsythOptimizedMesh(mesh);
- return mesh;
+ scene::IMesh *newmesh = createForsythOptimizedMesh(mesh);
+ mesh->drop();
+ return newmesh;
}
/*