backend-vnc: allocate head with xzalloc

Let xzalloc warn and abort when running out of memory.
With this, vnc_head_create() doesn't need an error return value anymore.
Remove the now unnecessary error handling.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
Philipp Zabel 2022-12-03 10:58:39 +01:00 committed by Philipp Zabel
parent 2b3f5f7821
commit 1e6e885e36

View File

@ -720,14 +720,12 @@ vnc_destroy(struct weston_compositor *ec)
free(backend);
}
static int
static void
vnc_head_create(struct weston_compositor *compositor, const char *name)
{
struct vnc_head *head;
head = zalloc(sizeof *head);
if (!head)
return -1;
head = xzalloc(sizeof *head);
weston_head_init(&head->base, name);
@ -735,8 +733,6 @@ vnc_head_create(struct weston_compositor *compositor, const char *name)
weston_head_set_connection_status(&head->base, true);
weston_compositor_add_head(compositor, &head->base);
return 0;
}
static void
@ -970,8 +966,7 @@ vnc_backend_create(struct weston_compositor *compositor,
if (pixman_renderer_init(compositor) < 0)
goto err_compositor;
if (vnc_head_create(compositor, "vnc") < 0)
goto err_compositor;
vnc_head_create(compositor, "vnc");
compositor->capabilities |= WESTON_CAP_ARBITRARY_MODES;