[Bf-blender-cvs] [1ec83f4] master: Fix possible (unlikely) memory leak

Campbell Barton noreply at git.blender.org
Fri Feb 20 07:19:09 CET 2015


Commit: 1ec83f41c1be97e757ebdca357b39ee0cca240c1
Author: Campbell Barton
Date:   Fri Feb 20 17:09:40 2015 +1100
Branches: master
https://developer.blender.org/rB1ec83f41c1be97e757ebdca357b39ee0cca240c1

Fix possible (unlikely) memory leak

===================================================================

M	source/blender/blenkernel/intern/mesh_mapping.c

===================================================================

diff --git a/source/blender/blenkernel/intern/mesh_mapping.c b/source/blender/blenkernel/intern/mesh_mapping.c
index 9e490ae..8d9fbe4 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.c
+++ b/source/blender/blenkernel/intern/mesh_mapping.c
@@ -724,8 +724,8 @@ bool BKE_mesh_calc_islands_loop_poly_uv(
 	MeshElemMap *edge_poly_map;
 	int *edge_poly_mem;
 
-	int *poly_indices = MEM_mallocN(sizeof(*poly_indices) * (size_t)totpoly, __func__);
-	int *loop_indices = MEM_mallocN(sizeof(*loop_indices) * (size_t)totloop, __func__);
+	int *poly_indices;
+	int *loop_indices;
 	int num_pidx, num_lidx;
 
 	/* Those are used to detect 'inner cuts', i.e. edges that are borders, and yet have two or more polys of
@@ -758,6 +758,9 @@ bool BKE_mesh_calc_islands_loop_poly_uv(
 		edge_innercut_indices = MEM_mallocN(sizeof(*edge_innercut_indices) * (size_t)num_edge_borders, __func__);
 	}
 
+	poly_indices = MEM_mallocN(sizeof(*poly_indices) * (size_t)totpoly, __func__);
+	loop_indices = MEM_mallocN(sizeof(*loop_indices) * (size_t)totloop, __func__);
+
 	/* Note: here we ignore '0' invalid group - this should *never* happen in this case anyway? */
 	for (grp_idx = 1; grp_idx <= num_poly_groups; grp_idx++) {
 		num_pidx = num_lidx = 0;




More information about the Bf-blender-cvs mailing list