Fix memory leak in boundary brush preview data

The edge preview data of the boundary needs to be freed with the
boundary data created for the brush. Also, all data for the
ScultpSession preview that is used to render the cursor needs to be
freed with the ##SculptSession##.

Found by Jacques Lucke

Reviewed By: JacquesLucke

Differential Revision: https://developer.blender.org/D10173
This commit is contained in:
Pablo Dobarro 2021-02-03 20:54:30 +01:00 committed by Pablo Dobarro
parent 5eb5a7f4b7
commit 7bde2844ae
2 changed files with 9 additions and 0 deletions

View File

@ -1487,6 +1487,14 @@ void BKE_sculptsession_free(Object *ob)
MEM_SAFE_FREE(ss->pose_ik_chain_preview);
}
if (ss->boundary_preview) {
MEM_SAFE_FREE(ss->boundary_preview->vertices);
MEM_SAFE_FREE(ss->boundary_preview->edges);
MEM_SAFE_FREE(ss->boundary_preview->distance);
MEM_SAFE_FREE(ss->boundary_preview->edit_info);
MEM_SAFE_FREE(ss->boundary_preview);
}
BKE_sculptsession_free_vwpaint_data(ob->sculpt);
MEM_freeN(ss);

View File

@ -530,6 +530,7 @@ SculptBoundary *SCULPT_boundary_data_init(Object *object,
void SCULPT_boundary_data_free(SculptBoundary *boundary)
{
MEM_SAFE_FREE(boundary->vertices);
MEM_SAFE_FREE(boundary->edges);
MEM_SAFE_FREE(boundary->distance);
MEM_SAFE_FREE(boundary->edit_info);
MEM_SAFE_FREE(boundary->bend.pivot_positions);