vkd3d-compiler: Do not overallocate memory for shader code.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-08-15 13:57:52 +02:00 committed by Alexandre Julliard
parent 98689bf33c
commit f7a21ad982
2 changed files with 2 additions and 2 deletions

View File

@ -2509,7 +2509,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_load_constant(struct vkd3d_dxbc_compile
const struct vkd3d_shader_register *reg, DWORD swizzle, DWORD write_mask)
{
unsigned int component_count = vkd3d_write_mask_component_count(write_mask);
uint32_t values[VKD3D_VEC4_SIZE];
uint32_t values[VKD3D_VEC4_SIZE] = {0};
unsigned int i, j;
assert(reg->type == VKD3DSPR_IMMCONST);

View File

@ -46,7 +46,7 @@ static bool read_shader(struct vkd3d_shader_code *shader, const char *filename)
return false;
}
if (!(code = malloc(sizeof(uint32_t) * shader->size)))
if (!(code = malloc(shader->size)))
{
fprintf(stderr, "Out of memory.\n");
fclose(fd);