diff options
author | SooChan Lim <sc1.lim@samsung.com> | 2022-04-19 12:06:23 +0900 |
---|---|---|
committer | Xuelian Bai <xuelian.bai@samsung.com> | 2024-01-18 09:31:56 +0800 |
commit | ebe282f610dcfd8b33b1a8e9624eac101a11d834 (patch) | |
tree | e74f7c41c8a1a7cb151f194931a9345ad83e7f85 | |
parent | ad1bff80838ab8bfa295cbdc0d0512af65546cde (diff) | |
download | mesa-ebe282f610dcfd8b33b1a8e9624eac101a11d834.tar.gz mesa-ebe282f610dcfd8b33b1a8e9624eac101a11d834.tar.bz2 mesa-ebe282f610dcfd8b33b1a8e9624eac101a11d834.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 502906fd2cf..0f679f813e2 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); |