src/wieldmesh.cpp: Fix mesh extrusion memory leak

This commit is contained in:
Břetislav Štec 2015-08-02 00:16:31 +02:00 committed by kwolekr
parent ebe7b31538
commit c4287a0d68

@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define MIN_EXTRUSION_MESH_RESOLUTION 16 #define MIN_EXTRUSION_MESH_RESOLUTION 16
#define MAX_EXTRUSION_MESH_RESOLUTION 512 #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; const f32 r = 0.5;
@ -114,8 +114,9 @@ static scene::IMesh* createExtrusionMesh(int resolution_x, int resolution_y)
mesh->addMeshBuffer(buf); mesh->addMeshBuffer(buf);
buf->drop(); buf->drop();
scaleMesh(mesh, scale); // also recalculates bounding box scaleMesh(mesh, scale); // also recalculates bounding box
mesh = (scene::SMesh *)createForsythOptimizedMesh(mesh); scene::IMesh *newmesh = createForsythOptimizedMesh(mesh);
return mesh; mesh->drop();
return newmesh;
} }
/* /*