backend-rdp: Correctly tear down the RDP back-end

This fixes the tear-down and the destroying part in case RDP back-end
couldn't be initialized. The first issue is the rdp_output which will
not be created in some circumstances (can't open the socket for
instance) and requires a guard check, and secondly, the
rdp_head being created above of that, wasn't removed and tripped an
assert when destroying the compositor instance.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
dev
Marius Vlad 4 years ago
parent 5699dbaae7
commit 5b357a4bbb
  1. 6
      libweston/backend-rdp/rdp.c

@ -1297,6 +1297,8 @@ rdp_backend_create(struct weston_compositor *compositor,
char *fd_tail;
int fd, ret;
struct weston_head *base, *next;
b = zalloc(sizeof *b);
if (b == NULL)
return NULL;
@ -1369,8 +1371,12 @@ rdp_backend_create(struct weston_compositor *compositor,
err_listener:
freerdp_listener_free(b->listener);
err_output:
if (b->output)
weston_output_release(&b->output->base);
err_compositor:
wl_list_for_each_safe(base, next, &compositor->head_list, compositor_link)
rdp_head_destroy(to_rdp_head(base));
weston_compositor_shutdown(compositor);
err_free_strings:
free(b->rdp_key);

Loading…
Cancel
Save