[Bf-blender-cvs] [4cd7dc6860a] master: GPencil: Fix memory leak issue

Antonioya noreply at git.blender.org
Wed Feb 27 15:59:59 CET 2019


Commit: 4cd7dc6860a63d96b484372818c024b2cdd6379b
Author: Antonioya
Date:   Wed Feb 27 15:59:40 2019 +0100
Branches: master
https://developer.blender.org/rB4cd7dc6860a63d96b484372818c024b2cdd6379b

GPencil: Fix memory leak issue

After a previous commit to use unique identifiers for Ghash key, I had missed to free the memory of the name key.

Thanks to Jacques Lucke for detecting the leak.

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

M	source/blender/draw/engines/gpencil/gpencil_engine.c

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

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 16d90b261bd..5112ba101a9 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -666,7 +666,7 @@ void GPENCIL_cache_finish(void *vedata)
 		DRW_gpencil_populate_particles(&e_data, gh_objects, vedata);
 
 		/* free hash */
-		BLI_ghash_free(gh_objects, NULL, NULL);
+		BLI_ghash_free(gh_objects, MEM_freeN, NULL);
 	}
 
 	if (stl->g_data->session_flag & (GP_DRW_PAINT_IDLE | GP_DRW_PAINT_FILLING)) {
@@ -719,6 +719,7 @@ static void gpencil_free_obj_runtime(GPENCIL_StorageList *stl)
 
 		/* free shgrp array */
 		cache_ob->tot_layers = 0;
+		MEM_SAFE_FREE(cache_ob->name);
 		MEM_SAFE_FREE(cache_ob->shgrp_array);
 	}



More information about the Bf-blender-cvs mailing list