summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSooChan Lim <sc1.lim@samsung.com>2022-04-19 12:06:23 +0900
committerXuelian Bai <xuelian.bai@samsung.com>2023-08-15 14:02:15 +0800
commitcd4afc41f06085b543a249e106e1ca12cf3aea88 (patch)
tree81977c13f2b31246fd8c5f77b93e09d4eba597bc
parentae459e412efe72479b91088e5c9d3ea538f7937f (diff)
downloadmesa-cd4afc41f06085b543a249e106e1ca12cf3aea88.tar.gz
mesa-cd4afc41f06085b543a249e106e1ca12cf3aea88.tar.bz2
mesa-cd4afc41f06085b543a249e106e1ca12cf3aea88.zip
fix the fd leak
Change-Id: I67de75fc242ccba1dd41a08784241ced6b898de8
-rwxr-xr-xsrc/egl/drivers/dri2/platform_tizen.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/platform_tizen.c b/src/egl/drivers/dri2/platform_tizen.c
index 70a1d795f8d..cad50afa715 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;
@@ -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);