[Bf-blender-cvs] [cbc6212] hair_immediate_fixes: Free strand edit memory after use.

Lukas Tönne noreply at git.blender.org
Fri Nov 28 14:15:43 CET 2014


Commit: cbc6212dc25bb3f0ab3191f2412ad3b7307d6d06
Author: Lukas Tönne
Date:   Fri Nov 28 14:15:14 2014 +0100
Branches: hair_immediate_fixes
https://developer.blender.org/rBcbc6212dc25bb3f0ab3191f2412ad3b7307d6d06

Free strand edit memory after use.

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

M	source/blender/blenkernel/intern/particle.c
M	source/blender/editors/hair/hair_edit.c

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

diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 9d38e69..fe66955 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -567,8 +567,11 @@ void psys_free(Object *ob, ParticleSystem *psys)
 
 		if (psys->edit && psys->free_edit)
 			psys->free_edit(psys->edit);
-		if (psys->hairedit)
+		if (psys->hairedit) {
 			BKE_editstrands_free(psys->hairedit);
+			MEM_freeN(psys->hairedit);
+			psys->hairedit = NULL;
+		}
 
 		if (psys->child) {
 			MEM_freeN(psys->child);
diff --git a/source/blender/editors/hair/hair_edit.c b/source/blender/editors/hair/hair_edit.c
index e52aaca..611259b 100644
--- a/source/blender/editors/hair/hair_edit.c
+++ b/source/blender/editors/hair/hair_edit.c
@@ -31,6 +31,8 @@
 
 #include <stdlib.h>
 
+#include "MEM_guardedalloc.h"
+
 #include "BLI_utildefines.h"
 
 #include "DNA_object_types.h"
@@ -84,6 +86,7 @@ static bool apply_hair_edit(Object *ob)
 			psys->flag |= PSYS_EDITED;
 			
 			BKE_editstrands_free(psys->hairedit);
+			MEM_freeN(psys->hairedit);
 			psys->hairedit = NULL;
 		}




More information about the Bf-blender-cvs mailing list