xwayland/glamor-gbm: Use `calloc()`

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

View File

@ -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;