Fix T62944: Memory leak in animation playback
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 28 Mar 2019 11:07:58 +0000 (12:07 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 28 Mar 2019 11:07:58 +0000 (12:07 +0100)
Missing memory free in the early output of particles distribute
initialization.

Seems it was always there.

source/blender/blenkernel/intern/particle_distribute.c

index fc3c998ca1c089b11bfe504f9df69c99a8e39c66..fc8292531dc32cb9468214d57b50c79b5079abe8 100644 (file)
@@ -1055,6 +1055,14 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx, Parti
 
        if (totmapped == 0) {
                /* We are not allowed to distribute particles anywhere... */
+               if (mesh != final_mesh) {
+                       BKE_id_free(NULL, mesh);
+               }
+               BLI_kdtree_3d_free(tree);
+               BLI_rng_free(rng);
+               MEM_freeN(element_weight);
+               MEM_freeN(particle_element);
+               MEM_freeN(jitter_offset);
                return 0;
        }