forked from bartvdbraak/blender
Fix memory leaks mesh w/ mesh remapping
This commit is contained in:
parent
d47e565598
commit
36630b7e85
@ -797,8 +797,8 @@ bool BKE_mesh_calc_islands_loop_poly_uv(
|
|||||||
|
|
||||||
/* Those are used to detect 'inner cuts', i.e. edges that are borders, and yet have two or more polys of
|
/* Those are used to detect 'inner cuts', i.e. edges that are borders, and yet have two or more polys of
|
||||||
* a same group using them (typical case: seam used to unwrap properly a cylinder). */
|
* a same group using them (typical case: seam used to unwrap properly a cylinder). */
|
||||||
BLI_bitmap *edge_borders;
|
BLI_bitmap *edge_borders = NULL;
|
||||||
int num_edge_borders;
|
int num_edge_borders = 0;
|
||||||
char *edge_border_count = NULL;
|
char *edge_border_count = NULL;
|
||||||
int *edge_innercut_indices = NULL;
|
int *edge_innercut_indices = NULL;
|
||||||
int num_einnercuts = 0;
|
int num_einnercuts = 0;
|
||||||
@ -817,6 +817,12 @@ bool BKE_mesh_calc_islands_loop_poly_uv(
|
|||||||
|
|
||||||
if (!num_poly_groups) {
|
if (!num_poly_groups) {
|
||||||
/* Should never happen... */
|
/* Should never happen... */
|
||||||
|
MEM_freeN(edge_poly_map);
|
||||||
|
MEM_freeN(edge_poly_mem);
|
||||||
|
|
||||||
|
if (edge_borders) {
|
||||||
|
MEM_freeN(edge_borders);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -861,9 +867,17 @@ bool BKE_mesh_calc_islands_loop_poly_uv(
|
|||||||
num_einnercuts, edge_innercut_indices);
|
num_einnercuts, edge_innercut_indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MEM_freeN(edge_poly_map);
|
||||||
|
MEM_freeN(edge_poly_mem);
|
||||||
|
|
||||||
MEM_freeN(poly_indices);
|
MEM_freeN(poly_indices);
|
||||||
MEM_freeN(loop_indices);
|
MEM_freeN(loop_indices);
|
||||||
MEM_freeN(poly_groups);
|
MEM_freeN(poly_groups);
|
||||||
|
|
||||||
|
if (edge_borders) {
|
||||||
|
MEM_freeN(edge_borders);
|
||||||
|
}
|
||||||
|
|
||||||
if (num_edge_borders) {
|
if (num_edge_borders) {
|
||||||
MEM_freeN(edge_border_count);
|
MEM_freeN(edge_border_count);
|
||||||
MEM_freeN(edge_innercut_indices);
|
MEM_freeN(edge_innercut_indices);
|
||||||
|
@ -1933,15 +1933,27 @@ void BKE_mesh_remap_calc_loops_from_dm(
|
|||||||
if (looptri_allocated_src) {
|
if (looptri_allocated_src) {
|
||||||
MEM_freeN((void *)looptri_src);
|
MEM_freeN((void *)looptri_src);
|
||||||
}
|
}
|
||||||
|
if (vert_to_loop_map_src) {
|
||||||
|
MEM_freeN(vert_to_loop_map_src);
|
||||||
|
}
|
||||||
if (vert_to_loop_map_src_buff) {
|
if (vert_to_loop_map_src_buff) {
|
||||||
MEM_freeN(vert_to_loop_map_src_buff);
|
MEM_freeN(vert_to_loop_map_src_buff);
|
||||||
}
|
}
|
||||||
|
if (vert_to_poly_map_src) {
|
||||||
|
MEM_freeN(vert_to_poly_map_src);
|
||||||
|
}
|
||||||
if (vert_to_poly_map_src_buff) {
|
if (vert_to_poly_map_src_buff) {
|
||||||
MEM_freeN(vert_to_poly_map_src_buff);
|
MEM_freeN(vert_to_poly_map_src_buff);
|
||||||
}
|
}
|
||||||
|
if (edge_to_poly_map_src) {
|
||||||
|
MEM_freeN(edge_to_poly_map_src);
|
||||||
|
}
|
||||||
if (edge_to_poly_map_src_buff) {
|
if (edge_to_poly_map_src_buff) {
|
||||||
MEM_freeN(edge_to_poly_map_src_buff);
|
MEM_freeN(edge_to_poly_map_src_buff);
|
||||||
}
|
}
|
||||||
|
if (poly_to_looptri_map_src) {
|
||||||
|
MEM_freeN(poly_to_looptri_map_src);
|
||||||
|
}
|
||||||
if (poly_to_looptri_map_src_buff) {
|
if (poly_to_looptri_map_src_buff) {
|
||||||
MEM_freeN(poly_to_looptri_map_src_buff);
|
MEM_freeN(poly_to_looptri_map_src_buff);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user