backend/drm: fix libliftoff_plane double-free

Destroying the liftoff_device invalidates all of the liftoff_planes.
Destroy the liftoff_planes before the liftoff_device to fix this.
master
Simon Ser 1 year ago committed by Alexander Orzechowski
parent 8714657d7b
commit fffa1908af

@ -323,9 +323,6 @@ void finish_drm_resources(struct wlr_drm_backend *drm) {
for (size_t i = 0; i < drm->num_planes; ++i) { for (size_t i = 0; i < drm->num_planes; ++i) {
struct wlr_drm_plane *plane = &drm->planes[i]; struct wlr_drm_plane *plane = &drm->planes[i];
wlr_drm_format_set_finish(&plane->formats); wlr_drm_format_set_finish(&plane->formats);
#if HAVE_LIBLIFTOFF
liftoff_plane_destroy(plane->liftoff);
#endif
} }
free(drm->planes); free(drm->planes);

@ -109,6 +109,11 @@ static void finish(struct wlr_drm_backend *drm) {
liftoff_output_destroy(crtc->liftoff); liftoff_output_destroy(crtc->liftoff);
} }
for (size_t i = 0; i < drm->num_planes; i++) {
struct wlr_drm_plane *plane = &drm->planes[i];
liftoff_plane_destroy(plane->liftoff);
}
liftoff_device_destroy(drm->liftoff); liftoff_device_destroy(drm->liftoff);
} }

Loading…
Cancel
Save