From bb766ef11227bd8c71ac65845d1930edd0eda40d Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 4 Nov 2017 23:06:29 +0100 Subject: [PATCH] randr: ProcRRGetOutputInfo: initialize memory Running Xephyr under valgrind reveals that we're sending some uninitialized memory over the wire (particularly, the leftover padding that comes from rounding extraLen to the next 32-bit multiple). Solve by calloc()ing the memory instead of malloc()ing (the alternative would be to memset just the padding, but I'm not sure it's more convenient.) Signed-off-by: Giuseppe Bilotta Reviewed-by: Adam Jackson --- randr/rroutput.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/randr/rroutput.c b/randr/rroutput.c index a8efec409..647f19a52 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -459,7 +459,7 @@ ProcRRGetOutputInfo(ClientPtr client) if (extraLen) { rep.length += bytes_to_int32(extraLen); - extra = malloc(extraLen); + extra = calloc(1, extraLen); if (!extra) return BadAlloc; }