[Bf-blender-cvs] [698bae05aa6] blender2.8: Eevee: Fix conditional statement depending on unitialized value

Dalai Felinto noreply at git.blender.org
Wed Aug 30 17:21:47 CEST 2017


Commit: 698bae05aa6935d2f06b307c9817f979c5ace29a
Author: Dalai Felinto
Date:   Wed Aug 30 11:09:07 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB698bae05aa6935d2f06b307c9817f979c5ace29a

Eevee: Fix conditional statement depending on unitialized value

Basically since g_data was malloc'ed (instead of calloc'ed)
g_data->minzbuffer was never initialized.

So when running DRW_framebuffer_init after EEVEE_effects_init, the test
to *g_data->minzbuffer would lead to unpredictable results.

This was caught by valgrind, reported by Sergey Sharybin.

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

M	source/blender/draw/engines/eevee/eevee_engine.c

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

diff --git a/source/blender/draw/engines/eevee/eevee_engine.c b/source/blender/draw/engines/eevee/eevee_engine.c
index 99dff4ec51a..9ab551ad949 100644
--- a/source/blender/draw/engines/eevee/eevee_engine.c
+++ b/source/blender/draw/engines/eevee/eevee_engine.c
@@ -51,7 +51,7 @@ static void EEVEE_engine_init(void *ved)
 
 	if (!stl->g_data) {
 		/* Alloc transient pointers */
-		stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
+		stl->g_data = MEM_callocN(sizeof(*stl->g_data), __func__);
 	}
 	stl->g_data->background_alpha = 1.0f;
 	stl->g_data->valid_double_buffer = (txl->color_double_buffer != NULL);



More information about the Bf-blender-cvs mailing list