[Bf-blender-cvs] [593fee0e7dd] hair_guides: Fix memleak from unfreed local array.

Lukas Tönne noreply at git.blender.org
Sun Nov 19 11:27:02 CET 2017


Commit: 593fee0e7dd104a9d92f117ccc9e1afb257deb07
Author: Lukas Tönne
Date:   Sun Nov 19 10:05:17 2017 +0000
Branches: hair_guides
https://developer.blender.org/rB593fee0e7dd104a9d92f117ccc9e1afb257deb07

Fix memleak from unfreed local array.

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

M	source/blender/blenkernel/BKE_hair.h
M	source/blender/blenkernel/intern/hair_draw.c

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

diff --git a/source/blender/blenkernel/BKE_hair.h b/source/blender/blenkernel/BKE_hair.h
index b77feb004ee..7082a898576 100644
--- a/source/blender/blenkernel/BKE_hair.h
+++ b/source/blender/blenkernel/BKE_hair.h
@@ -79,7 +79,7 @@ void BKE_hair_bind_follicles(struct HairSystem *hsys, struct DerivedMesh *scalp)
 
 /* === Draw Settings === */
 
-struct HairDrawSettings* BKE_hair_draw_settings_new();
+struct HairDrawSettings* BKE_hair_draw_settings_new(void);
 struct HairDrawSettings* BKE_hair_draw_settings_copy(struct HairDrawSettings *draw_settings);
 void BKE_hair_draw_settings_free(struct HairDrawSettings *draw_settings);
 
diff --git a/source/blender/blenkernel/intern/hair_draw.c b/source/blender/blenkernel/intern/hair_draw.c
index fbff204b3a7..10f78fe14c6 100644
--- a/source/blender/blenkernel/intern/hair_draw.c
+++ b/source/blender/blenkernel/intern/hair_draw.c
@@ -45,7 +45,7 @@
 
 /* === Draw Settings === */
 
-HairDrawSettings* BKE_hair_draw_settings_new()
+HairDrawSettings* BKE_hair_draw_settings_new(void)
 {
 	HairDrawSettings *draw_settings = MEM_callocN(sizeof(HairDrawSettings), "hair draw settings");
 	
@@ -267,6 +267,8 @@ static void hair_get_strand_buffer(
 		++smap;
 		svert += len;
 	}
+	
+	MEM_freeN(vertco);
 }
 
 static void hair_get_fiber_buffer(const HairSystem* hsys, DerivedMesh *scalp,



More information about the Bf-blender-cvs mailing list