backend-drm/drm-gbm: gbm_device_destroy on an invalid gbm device

When EGL initialization fails (failure to create a GLES3 or GLES2
context) we will end up calling gbm_device_destroy() twice, once
in init_egl() and once in the drm_backend_create() error path.

Given that we should also take care of properly destroying the gbm
device when we don't have any inputs for instance, mark the gbm device
as NULL to avoid calling gbm_device_destroy() once more when destroying
the DRM-backend.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2021-12-28 13:23:48 +02:00 committed by Simon Ser
parent 3c5e6c536f
commit bb55d86300

View file

@ -125,6 +125,7 @@ init_egl(struct drm_backend *b)
if (drm_backend_create_gl_renderer(b) < 0) {
gbm_device_destroy(b->gbm);
b->gbm = NULL;
return -1;
}