[Mesa-dev] [PATCH 1/3] egl/dri2: Close file descriptor on error.
Matt Turner
mattst88 at gmail.com
Wed Jul 15 09:00:41 PDT 2015
---
src/egl/drivers/dri2/platform_drm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c
index 0d1f4c6..a8c5401 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -619,18 +619,22 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
fd = loader_open_device("/dev/dri/card0");
dri2_dpy->own_device = 1;
gbm = gbm_create_device(fd);
- if (gbm == NULL)
+ if (gbm == NULL) {
+ close(fd);
return EGL_FALSE;
+ }
}
if (strcmp(gbm_device_get_backend_name(gbm), "drm") != 0) {
free(dri2_dpy);
+ close(fd);
return EGL_FALSE;
}
dri2_dpy->gbm_dri = gbm_dri_device(gbm);
if (dri2_dpy->gbm_dri->base.type != GBM_DRM_DRIVER_TYPE_DRI) {
free(dri2_dpy);
+ close(fd);
return EGL_FALSE;
}
--
2.3.6
More information about the mesa-dev
mailing list