From 4a857b161ce1202c60ac464c8eb6de358fed5508 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Wed, 30 Oct 2019 13:11:28 +0100 Subject: [PATCH] xwayland/shm: Use `calloc()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, Xwayland pixmap SHM code uses `malloc()` to allocate the xwl_pixmap. Use `calloc()` instead, as the EGLstream backend does, as it is safer (initializing the allocated data to 0). Signed-off-by: Olivier Fourdan Reviewed-by: Michel Dänzer --- hw/xwayland/xwayland-shm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c index d1127efc0..bce74fa1d 100644 --- a/hw/xwayland/xwayland-shm.c +++ b/hw/xwayland/xwayland-shm.c @@ -210,7 +210,7 @@ xwl_shm_create_pixmap(ScreenPtr screen, if (!pixmap) return NULL; - xwl_pixmap = malloc(sizeof *xwl_pixmap); + xwl_pixmap = calloc(1, sizeof(*xwl_pixmap)); if (xwl_pixmap == NULL) goto err_destroy_pixmap;