Skip to content

egl: fix mem leak in error path

Eric Engestrom requested to merge eric/mesa:egl-leak into master

Fixes: d6edccee ("egl: add EGL_platform_device support")
/cc @evelikov


While this fixes the leak, I'm wondering if this path should exist at all; isn't it unreachable without an internal EGL bug?

If so, I think we should have this instead:

diff --git a/src/egl/drivers/dri2/platform_device.c b/src/egl/drivers/dri2/platform_device.c
index cc776bfa4ce3ae93e4f5..8ca01b3a3e6f9a9c1a01 100644
--- a/src/egl/drivers/dri2/platform_device.c
+++ b/src/egl/drivers/dri2/platform_device.c
@@ -401,8 +401,7 @@ dri2_initialize_device(_EGLDriver *drv, _EGLDisplay *disp)
       if (!device_probe_device_sw(disp))
          goto cleanup;
    } else {
-      _eglLog(_EGL_FATAL, "Driver bug: exposed device is neither DRM nor SOFTWARE one");
-      return EGL_FALSE;
+      unreachable("Driver bug: exposed device is neither DRM nor SOFTWARE one");
    }
 
    if (!dri2_create_screen(disp)) {

Merge request reports