Fix memory leak when single_obdata_users() fails to copy datablock

This commit is contained in:
Dalai Felinto 2017-11-30 10:37:54 -02:00
parent ba17d53e59
commit 79bbbf7e20
1 changed files with 5 additions and 2 deletions

View File

@ -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;
}