Free the device_name, reported by Pekka Paalanen.
Destroy wayland display and drm resources,
if created by dri2_initialize_wayland.
close(dri2_dpy->fd);
if (dri2_dpy->driver)
dlclose(dri2_dpy->driver);
+ if (dri2_dpy->device_name)
+ free(dri2_dpy->device_name);
if (disp->PlatformDisplay == NULL) {
switch (disp->Platform) {
xcb_disconnect(dri2_dpy->conn);
break;
#endif
-#ifdef HAVE_WAYLAND_PLATFORM
- case _EGL_PLATFORM_WAYLAND:
- wl_display_destroy(dri2_dpy->wl_dpy);
- break;
-#endif
#ifdef HAVE_DRM_PLATFORM
case _EGL_PLATFORM_DRM:
- if (dri2_dpy->own_gbm_device) {
+ if (dri2_dpy->own_device) {
gbm_device_destroy(&dri2_dpy->gbm_dri->base.base);
}
break;
__DRIimageExtension *image;
int fd;
+ int own_device;
#ifdef HAVE_DRM_PLATFORM
struct gbm_dri_device *gbm_dri;
- int own_gbm_device;
#endif
char *device_name;
gbm = disp->PlatformDisplay;
if (gbm == NULL) {
fd = open("/dev/dri/card0", O_RDWR);
- dri2_dpy->own_gbm_device = 1;
+ dri2_dpy->own_device = 1;
gbm = gbm_create_device(fd);
if (gbm == NULL)
return EGL_FALSE;
close(dri2_dpy->fd);
dlclose(dri2_dpy->driver);
free(dri2_dpy->driver_name);
+ free(dri2_dpy->device_name);
+ wl_drm_destroy(dri2_dpy->wl_drm);
+ if (dri2_dpy->own_device)
+ wl_display_destroy(dri2_dpy->wl_dpy);
free(dri2_dpy);
disp->DriverData = NULL;
dri2_dpy->wl_dpy = wl_display_connect(NULL);
if (dri2_dpy->wl_dpy == NULL)
goto cleanup_dpy;
+ dri2_dpy->own_device = 1;
} else {
dri2_dpy->wl_dpy = disp->PlatformDisplay;
}