[Bf-blender-cvs] [2f0aca45966] blender2.8: Particle mode: Fix memory leak with simple interpolated children

Sergey Sharybin noreply at git.blender.org
Fri May 11 15:40:49 CEST 2018


Commit: 2f0aca45966c3459a08f3f7e371ead764b19adfb
Author: Sergey Sharybin
Date:   Fri May 11 15:40:14 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB2f0aca45966c3459a08f3f7e371ead764b19adfb

Particle mode: Fix memory leak with simple interpolated children

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

M	source/blender/draw/intern/draw_cache_impl_particles.c

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

diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index 1c39cbc16cd..a73731bec2f 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -277,7 +277,18 @@ static void particle_calculate_uvs(ParticleSystem *psys,
                                    float (**r_parent_uvs)[2],
                                    float (**r_uv)[2])
 {
-	if (psmd != NULL) {
+	if (psmd == NULL) {
+		return;
+	}
+	if (is_simple) {
+		if (r_parent_uvs[parent_index] != NULL) {
+			*r_uv = r_parent_uvs[parent_index];
+		}
+		else {
+			*r_uv = MEM_callocN(sizeof(**r_uv) * num_uv_layers, "Particle UVs");
+		}
+	}
+	else {
 		*r_uv = MEM_callocN(sizeof(**r_uv) * num_uv_layers, "Particle UVs");
 	}
 	if (child_index == -1) {



More information about the Bf-blender-cvs mailing list