From 361bd506dcfe97cb7a3c777935bc602fdce519b5 Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Fri, 24 Sep 2010 07:39:52 +0000 Subject: [PATCH] Fix for [#23970] Memory problem when setting hair amount to zero --- source/blender/blenkernel/intern/particle_system.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 3b9ad8d84ec..47a220dcefb 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -195,9 +195,11 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart) psys->free_edit = NULL; } - newpars= MEM_callocN(totpart*sizeof(ParticleData), "particles"); - if(psys->part->phystype == PART_PHYS_BOIDS) - newboids= MEM_callocN(totpart*sizeof(BoidParticle), "boid particles"); + if(totpart) { + newpars= MEM_callocN(totpart*sizeof(ParticleData), "particles"); + if(psys->part->phystype == PART_PHYS_BOIDS) + newboids= MEM_callocN(totpart*sizeof(BoidParticle), "boid particles"); + } if(psys->particles) { totsaved=MIN2(psys->totpart,totpart);