diff options
author | SooChan Lim <sc1.lim@samsung.com> | 2022-04-19 12:06:23 +0900 |
---|---|---|
committer | Xuelian Bai <xuelian.bai@samsung.com> | 2023-02-21 14:50:49 +0800 |
commit | 0a42187a06431b7e4d7a43d5d3c1d76931f06bcb (patch) | |
tree | 8b38586953eaee1734262fc95feb84cd8942c336 | |
parent | fde99dd23b44d5aee5e85ca0e1a07ba623d5b418 (diff) | |
download | mesa-0a42187a06431b7e4d7a43d5d3c1d76931f06bcb.tar.gz mesa-0a42187a06431b7e4d7a43d5d3c1d76931f06bcb.tar.bz2 mesa-0a42187a06431b7e4d7a43d5d3c1d76931f06bcb.zip |
fix the fd leak
Change-Id: I67de75fc242ccba1dd41a08784241ced6b898de8
-rwxr-xr-x | src/egl/drivers/dri2/platform_tizen.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c index acc8ea9ca13..9c3ca90f73a 100755 --- a/src/egl/drivers/dri2/platform_tizen.c +++ b/src/egl/drivers/dri2/platform_tizen.c @@ -1555,6 +1555,7 @@ dri2_initialize_tizen(_EGLDisplay *disp) tpl_backend_type_t tpl_backend = TPL_BACKEND_UNKNOWN; const char *err; int tbm_bufmgr_fd = -1; + int master_fd = -1; char *tbm_bufmgr_device_name = NULL; int hw_accel = (getenv("LIBGL_ALWAYS_SOFTWARE") == NULL); @@ -1594,7 +1595,6 @@ dri2_initialize_tizen(_EGLDisplay *disp) /* Get tbm_bufmgr's fd */ tbm_bufmgr_fd = tbm_drm_helper_get_fd(); - if (tbm_bufmgr_fd == -1) { err = "DRI2: failed to get tbm_bufmgr fd"; goto cleanup_device; @@ -1623,7 +1623,7 @@ dri2_initialize_tizen(_EGLDisplay *disp) } drmFreeDevices(devices, num_devices); #endif - + if (drmGetNodeTypeFromFd(tbm_bufmgr_fd) == DRM_NODE_RENDER) { tbm_bufmgr_device_name = loader_get_device_name_for_fd(tbm_bufmgr_fd); @@ -1633,7 +1633,8 @@ dri2_initialize_tizen(_EGLDisplay *disp) } dri2_dpy->fd = loader_open_device(tbm_bufmgr_device_name); - } else if (tbm_drm_helper_get_master_fd() >= 0) { + } else if ((master_fd = tbm_drm_helper_get_master_fd()) >= 0) { + close(master_fd); // display server always has master_fd, // so tbm_bufmgr_fd is the master_fd if it can get the tbm_master_fd. tbm_bufmgr_device_name = loader_get_device_name_for_fd(tbm_bufmgr_fd); |