xwayland/shm: Use `calloc()`

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 <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
Olivier Fourdan 2019-10-30 13:11:28 +01:00
parent 0d4667b65a
commit 4a857b161c

View File

@ -210,7 +210,7 @@ xwl_shm_create_pixmap(ScreenPtr screen,
if (!pixmap) if (!pixmap)
return NULL; return NULL;
xwl_pixmap = malloc(sizeof *xwl_pixmap); xwl_pixmap = calloc(1, sizeof(*xwl_pixmap));
if (xwl_pixmap == NULL) if (xwl_pixmap == NULL)
goto err_destroy_pixmap; goto err_destroy_pixmap;