Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-03-27 16:49:46 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-04-02 16:36:10 +0300
commit6cc4c68dad795a4ac63e06a1d63a1865f74210bd (patch)
treee32a1a2760a17dd2f1b1c7a32307e40d24501e60 /source/blender/editors/sculpt_paint
parent43f748a32fd541aac8cf499e03cf624806e30967 (diff)
Fix T75121: Memory leak in Surface Smooth
The brush was allocating new memory for storing the displacemnets at the beginning of each stroke step and not freeing them. Reviewed By: jbakker Maniphest Tasks: T75121 Differential Revision: https://developer.blender.org/D7254
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 73173571277..dbb89617b08 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3458,7 +3458,9 @@ static void do_surface_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, in
Brush *brush = BKE_paint_brush(&sd->paint);
SculptSession *ss = ob->sculpt;
- if (ss->cache->mirror_symmetry_pass == 0 && ss->cache->radial_symmetry_pass == 0) {
+ if (ss->cache->first_time && ss->cache->mirror_symmetry_pass == 0 &&
+ ss->cache->radial_symmetry_pass == 0) {
+ BLI_assert(ss->cache->surface_smooth_laplacian_disp == NULL);
ss->cache->surface_smooth_laplacian_disp = MEM_callocN(
SCULPT_vertex_count_get(ss) * 3 * sizeof(float), "HC smooth laplacian b");
}
@@ -6860,9 +6862,9 @@ static const char *sculpt_tool_name(Sculpt *sd)
void SCULPT_cache_free(StrokeCache *cache)
{
- if (cache->dial) {
- MEM_freeN(cache->dial);
- }
+ MEM_SAFE_FREE(cache->dial);
+ MEM_SAFE_FREE(cache->surface_smooth_laplacian_disp);
+
if (cache->pose_ik_chain) {
SCULPT_pose_ik_chain_free(cache->pose_ik_chain);
}