compositor: don't crash if destroying a compositor without a backend

Calling weston_compositor_destroy() on a pointer returned by
weston_compositor_create() should be always valid, even if the
compositor does not have yet a backend.

Signed-off-by: Giulio Camuffo <giuliocamuffo@gmail.com>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
This commit is contained in:
Giulio Camuffo 2015-10-03 16:25:15 +03:00 committed by Derek Foreman
parent 7e17fec68d
commit 2d24e64776

View File

@ -4767,7 +4767,8 @@ weston_compositor_destroy(struct weston_compositor *compositor)
weston_compositor_xkb_destroy(compositor);
compositor->backend->destroy(compositor);
if (compositor->backend)
compositor->backend->destroy(compositor);
free(compositor);
}