[Bf-blender-cvs] [a8e5ed2331c] soc-2019-adaptive-cloth: Cloth: fix memory leak

ishbosamiya noreply at git.blender.org
Thu Jun 20 09:20:49 CEST 2019


Commit: a8e5ed2331c0b9410160fea70a8059568c946a00
Author: ishbosamiya
Date:   Thu Jun 20 12:49:40 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rBa8e5ed2331c0b9410160fea70a8059568c946a00

Cloth: fix memory leak

Memory leak was caused due to improper freeing of cloth parameters that need to be reset when the number of vertices in the cloth change

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

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

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

diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 41a832129b0..9f39baa64b4 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -723,6 +723,11 @@ static Mesh *cloth_remeshing_update_cloth_object_bmesh(Object *ob, ClothModifier
     cloth->bvhselftree = NULL;
   }
 
+  if (cloth->implicit) {
+    BPH_mass_spring_solver_free(cloth->implicit);
+    cloth->implicit = NULL;
+  }
+
   // we save our faces for collision objects
   if (cloth->tri) {
     MEM_freeN(cloth->tri);



More information about the Bf-blender-cvs mailing list