[PATCH xserver 3/5] randr: ProcRRGetOutputInfo: initialize memory
Giuseppe Bilotta
giuseppe.bilotta at gmail.com
Sat Nov 4 22:06:29 UTC 2017
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 <giuseppe.bilotta at gmail.com>
---
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;
}
--
2.14.1.439.g647b9b4702
More information about the xorg-devel
mailing list