glsl: explicitly zero out padding to gl_shader_variable bitfield

Otherwise, the padding bits remain undefined, which leads to valgrind
errors when storing the gl_shader_variable in the disk cache.

v2: use rzalloc instead of an explicit padding member variable

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
Nicolai Hähnle 2017-06-24 10:27:18 +02:00
parent f4f7096c1d
commit 210ebd4b9c
1 changed files with 4 additions and 1 deletions

View File

@ -3732,7 +3732,10 @@ create_shader_variable(struct gl_shader_program *shProg,
bool use_implicit_location, int location,
const glsl_type *outermost_struct_type)
{
gl_shader_variable *out = ralloc(shProg, struct gl_shader_variable);
/* Allocate zero-initialized memory to ensure that bitfield padding
* is zero.
*/
gl_shader_variable *out = rzalloc(shProg, struct gl_shader_variable);
if (!out)
return NULL;