diff --git a/hw/xwayland/xwayland-drm-lease.c b/hw/xwayland/xwayland-drm-lease.c index 30d363b59..d9a7bb8c1 100644 --- a/hw/xwayland/xwayland-drm-lease.c +++ b/hw/xwayland/xwayland-drm-lease.c @@ -455,7 +455,7 @@ xwl_screen_add_drm_lease_device(struct xwl_screen *xwl_screen, uint32_t id) { struct wp_drm_lease_device_v1 *lease_device = wl_registry_bind( xwl_screen->registry, id, &wp_drm_lease_device_v1_interface, 1); - struct xwl_drm_lease_device *device_data = malloc(sizeof(struct xwl_drm_lease_device)); + struct xwl_drm_lease_device *device_data = calloc(1, sizeof(struct xwl_drm_lease_device)); device_data->drm_lease_device = lease_device; device_data->xwl_screen = xwl_screen; diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c index 05668b8e9..0d2a61edc 100644 --- a/hw/xwayland/xwayland-glamor-gbm.c +++ b/hw/xwayland/xwayland-glamor-gbm.c @@ -166,7 +166,6 @@ xwl_glamor_gbm_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo, Bool implicit_modifier) { PixmapPtr pixmap; - struct xwl_pixmap *xwl_pixmap; struct xwl_screen *xwl_screen = xwl_screen_get(screen); #ifdef GBM_BO_FD_FOR_PLANE struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); @@ -218,7 +217,7 @@ xwl_glamor_gbm_create_pixmap_for_bo(ScreenPtr screen, struct gbm_bo *bo, for (plane = 0; plane < num_planes; plane++) fds[plane] = -1; #endif - xwl_pixmap = calloc(1, sizeof(*xwl_pixmap)); + struct xwl_pixmap *xwl_pixmap = calloc(1, sizeof(struct xwl_pixmap)); if (xwl_pixmap == NULL) return NULL; @@ -717,7 +716,6 @@ xwl_dri3_open_client(ClientPtr client, { struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen); - struct xwl_auth_state *state; drm_magic_t magic; int fd; @@ -729,7 +727,7 @@ xwl_dri3_open_client(ClientPtr client, return Success; } - state = malloc(sizeof *state); + struct xwl_auth_state *state = calloc(1, sizeof(struct xwl_auth_state)); if (state == NULL) { close(fd); return BadAlloc; diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c index 308879213..d0d6fa67d 100644 --- a/hw/xwayland/xwayland-screen.c +++ b/hw/xwayland/xwayland-screen.c @@ -524,7 +524,7 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id, } else if (strcmp(interface, wp_drm_lease_device_v1_interface.name) == 0) { if (xwl_screen->screen->root == NULL) { - struct xwl_queued_drm_lease_device *queued = malloc(sizeof(struct xwl_queued_drm_lease_device)); + struct xwl_queued_drm_lease_device *queued = calloc(1, sizeof(struct xwl_queued_drm_lease_device)); queued->id = id; xorg_list_append(&queued->link, &xwl_screen->queued_drm_lease_devices); } else { diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c index faca5224e..929ca7450 100644 --- a/hw/xwayland/xwayland-shm.c +++ b/hw/xwayland/xwayland-shm.c @@ -128,7 +128,6 @@ os_create_anonymous_file(off_t size) { static const char template[] = "/xwayland-shared-XXXXXX"; const char *path; - char *name; int fd; int ret; @@ -151,7 +150,7 @@ os_create_anonymous_file(off_t size) return -1; } - name = malloc(strlen(path) + sizeof(template)); + char *name = calloc(1, strlen(path) + sizeof(template)); if (!name) return -1;