From 0d4667b65a81047fe5d5af537d295c64cfa08d9c Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Wed, 30 Oct 2019 11:50:24 +0100 Subject: [PATCH] xwayland/glamor-gbm: Use `calloc()` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, glamor GBM backend 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-glamor-gbm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c index 9cbce5f55..e3a4ba382 100644 --- a/hw/xwayland/xwayland-glamor-gbm.c +++ b/hw/xwayland/xwayland-glamor-gbm.c @@ -149,7 +149,7 @@ xwl_glamor_gbm_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo, struct xwl_pixmap *xwl_pixmap; struct xwl_screen *xwl_screen = xwl_screen_get(screen); - xwl_pixmap = malloc(sizeof *xwl_pixmap); + xwl_pixmap = calloc(1, sizeof(*xwl_pixmap)); if (xwl_pixmap == NULL) return NULL;