[Bf-blender-cvs] [22b35d7] alembic: Fixed minor memory leak when the bake operator exits early without freeing allocated data.

Lukas Tönne noreply at git.blender.org
Tue Apr 28 10:02:33 CEST 2015


Commit: 22b35d7217cf6fde00637c107e9946a6a8150d27
Author: Lukas Tönne
Date:   Tue Apr 28 10:01:50 2015 +0200
Branches: alembic
https://developer.blender.org/rB22b35d7217cf6fde00637c107e9946a6a8150d27

Fixed minor memory leak when the bake operator exits early without
freeing allocated data.

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

M	source/blender/editors/io/io_cache_library.c

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

diff --git a/source/blender/editors/io/io_cache_library.c b/source/blender/editors/io/io_cache_library.c
index ce8612f..51688b0 100644
--- a/source/blender/editors/io/io_cache_library.c
+++ b/source/blender/editors/io/io_cache_library.c
@@ -256,18 +256,17 @@ static void cache_library_bake_do(CacheLibraryBakeJob *data)
 {
 	Scene *scene = data->scene;
 	int frame, frame_prev, start_frame, end_frame;
+	CacheProcessData process_data;
 	
-	/* === prepare === */
+	if (cache_library_bake_stop(data))
+		return;
 	
-	CacheProcessData process_data;
+	/* === prepare === */
 	
 	process_data.lay = data->lay;
 	copy_m4_m4(process_data.mat, data->mat);
 	process_data.dupcache = BKE_dupli_cache_new();
 	
-	if (cache_library_bake_stop(data))
-		return;
-	
 	switch (data->cachelib->source_mode) {
 		case CACHE_LIBRARY_SOURCE_SCENE:
 			data->writer = PTC_writer_dupligroup(data->group->id.name, &data->eval_ctx, scene, data->group, data->cachelib);
@@ -276,8 +275,9 @@ static void cache_library_bake_do(CacheLibraryBakeJob *data)
 			data->writer = PTC_writer_duplicache(data->group->id.name, data->group, process_data.dupcache, data->cachelib->data_types, G.debug & G_DEBUG_SIMDATA);
 			break;
 	}
-	if (!data->writer)
-		return;
+	if (!data->writer) {
+		BKE_dupli_cache_free(process_data.dupcache);
+	}
 	
 	data->cachelib->flag |= CACHE_LIBRARY_BAKING;




More information about the Bf-blender-cvs mailing list