diff options
author | Matt Turner <[email protected]> | 2014-07-08 16:50:28 -0700 |
---|---|---|
committer | Matt Turner <[email protected]> | 2014-07-15 10:12:29 -0700 |
commit | 76caaedd7e6b5c9e1c3b4c951d5820df9f419228 (patch) | |
tree | 4fa2de0b4f378413abdb6230f0fe20d67ce70d5c /src | |
parent | 0d711e719e7c5b5a4a34521af97d84f3fb628efd (diff) |
i965: Initialize new chunks of realloc'd memory.
Otherwise we'd compare uninitialized pointers with NULL and dereference,
leading to crashes.
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_asm_annotation.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_asm_annotation.c b/src/mesa/drivers/dri/i965/intel_asm_annotation.c index 4717bafd341..6a51d899ff6 100644 --- a/src/mesa/drivers/dri/i965/intel_asm_annotation.c +++ b/src/mesa/drivers/dri/i965/intel_asm_annotation.c @@ -96,11 +96,15 @@ void annotate(struct brw_context *brw, struct backend_instruction *inst, unsigned offset) { if (annotation->ann_size <= annotation->ann_count) { + int old_size = annotation->ann_size; annotation->ann_size = MAX2(1024, annotation->ann_size * 2); annotation->ann = reralloc(annotation->mem_ctx, annotation->ann, struct annotation, annotation->ann_size); if (!annotation->ann) return; + + memset(annotation->ann + old_size, 0, + (annotation->ann_size - old_size) * sizeof(struct annotation)); } struct annotation *ann = &annotation->ann[annotation->ann_count++]; |