Skip to content

Commit c4287a0

Browse files
t0suj4kwolekr
authored andcommittedAug 2, 2015
src/wieldmesh.cpp: Fix mesh extrusion memory leak
1 parent ebe7b31 commit c4287a0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎src/wieldmesh.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
3737
#define MIN_EXTRUSION_MESH_RESOLUTION 16
3838
#define MAX_EXTRUSION_MESH_RESOLUTION 512
3939

40-
static scene::IMesh* createExtrusionMesh(int resolution_x, int resolution_y)
40+
static scene::IMesh *createExtrusionMesh(int resolution_x, int resolution_y)
4141
{
4242
const f32 r = 0.5;
4343

@@ -114,8 +114,9 @@ static scene::IMesh* createExtrusionMesh(int resolution_x, int resolution_y)
114114
mesh->addMeshBuffer(buf);
115115
buf->drop();
116116
scaleMesh(mesh, scale); // also recalculates bounding box
117-
mesh = (scene::SMesh *)createForsythOptimizedMesh(mesh);
118-
return mesh;
117+
scene::IMesh *newmesh = createForsythOptimizedMesh(mesh);
118+
mesh->drop();
119+
return newmesh;
119120
}
120121

121122
/*

0 commit comments

Comments
 (0)
Please sign in to comment.