[Bf-blender-cvs] [519ee15] master: Fix for memory leak in particle brush
Campbell Barton
noreply at git.blender.org
Sat Mar 1 06:26:25 CET 2014
Commit: 519ee151a325fdb32e7bb34352ef31940d422fc5
Author: Campbell Barton
Date: Sat Mar 1 16:25:37 2014 +1100
https://developer.blender.org/rB519ee151a325fdb32e7bb34352ef31940d422fc5
Fix for memory leak in particle brush
===================================================================
M source/blender/editors/physics/particle_edit.c
===================================================================
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index d9ec0cf..f634a51 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -3337,7 +3337,7 @@ static int brush_add(PEData *data, short number)
Object *ob= data->ob;
PTCacheEdit *edit = data->edit;
ParticleSystem *psys= edit->psys;
- ParticleData *add_pars= MEM_callocN(number*sizeof(ParticleData), "ParticleData add");
+ ParticleData *add_pars;
ParticleSystemModifierData *psmd= psys_get_modifier(ob, psys);
ParticleSimulationData sim= {0};
ParticleEditSettings *pset= PE_settings(scene);
@@ -3355,6 +3355,8 @@ static int brush_add(PEData *data, short number)
if (psys->flag & PSYS_GLOBAL_HAIR)
return 0;
+ add_pars = MEM_callocN(number * sizeof(ParticleData), "ParticleData add");
+
rng = BLI_rng_new_srandom(psys->seed+data->mval[0]+data->mval[1]);
sim.scene= scene;
@@ -3548,8 +3550,8 @@ static int brush_add(PEData *data, short number)
if (tree)
BLI_kdtree_free(tree);
}
- if (add_pars)
- MEM_freeN(add_pars);
+
+ MEM_freeN(add_pars);
if (!psmd->dm->deformedOnly)
dm->release(dm);
More information about the Bf-blender-cvs
mailing list