[Bf-blender-cvs] [79bbbf7e200] blender2.8: Fix memory leak when single_obdata_users() fails to copy datablock

Dalai Felinto noreply at git.blender.org
Thu Nov 30 14:09:25 CET 2017


Commit: 79bbbf7e200258b63c0e4e71e9a8508b11a95946
Author: Dalai Felinto
Date:   Thu Nov 30 10:37:54 2017 -0200
Branches: blender2.8
https://developer.blender.org/rB79bbbf7e200258b63c0e4e71e9a8508b11a95946

Fix memory leak when single_obdata_users() fails to copy datablock

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

M	source/blender/editors/object/object_relations.c

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

diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 895777fc63a..b2e976f17a9 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1846,8 +1846,11 @@ static void single_obdata_users(Main *bmain, Scene *scene, ViewLayer *view_layer
 						ob->data = ID_NEW_SET(ob->data, BKE_lightprobe_copy(bmain, ob->data));
 						break;
 					default:
-						if (G.debug & G_DEBUG)
-							printf("ERROR %s: can't copy %s\n", __func__, id->name);
+						printf("ERROR %s: can't copy %s\n", __func__, id->name);
+						BLI_assert(!"This should never happen.");
+
+						/* We need to end the FOREACH_OBJECT_FLAG iterator to prevent memory leak. */
+						BKE_scene_objects_iterator_end(&iter_macro);
 						return;
 				}



More information about the Bf-blender-cvs mailing list