summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangyeon Lee <cyeon.lee@samsung.com>2020-07-21 20:12:57 +0900
committerChangyeon Lee <cyeon.lee@samsung.com>2020-07-21 20:12:57 +0900
commit08136c6ad8dc1538405fdd6d3904967cdb51030c (patch)
tree9ac255eae11b4ca5de278f2c8d4c13b80c1e6ef5
parent0c4af0996b71f356e4cf099b3b6c93e03d679749 (diff)
downloadlibtbm-dumb-08136c6ad8dc1538405fdd6d3904967cdb51030c.tar.gz
libtbm-dumb-08136c6ad8dc1538405fdd6d3904967cdb51030c.tar.bz2
libtbm-dumb-08136c6ad8dc1538405fdd6d3904967cdb51030c.zip
fix fd leak
Change-Id: Ia628374918dea3e4dc4c6c39e9baed82472ef170
-rw-r--r--src/tbm_bufmgr_dumb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tbm_bufmgr_dumb.c b/src/tbm_bufmgr_dumb.c
index bcff466..32f2a06 100644
--- a/src/tbm_bufmgr_dumb.c
+++ b/src/tbm_bufmgr_dumb.c
@@ -1425,6 +1425,7 @@ tbm_dumb_init(tbm_bufmgr bufmgr, tbm_error_e *error)
tbm_backend_bufmgr_func *bufmgr_func = NULL;
tbm_backend_bo_func *bo_func = NULL;
int fp;
+ int set_master = 0;
tbm_error_e err;
uint64_t cap = 0;
uint32_t ret;
@@ -1459,6 +1460,7 @@ tbm_dumb_init(tbm_bufmgr bufmgr, tbm_error_e *error)
if (drmIsMaster(bufmgr_dumb->fd)) {
tbm_drm_helper_set_tbm_master_fd(bufmgr_dumb->fd);
+ set_master = 1;
bufmgr_dumb->device_name = drmGetDeviceNameFromFd(bufmgr_dumb->fd);
if (!bufmgr_dumb->device_name) {
@@ -1597,10 +1599,9 @@ fail_alloc_bufmgr_func:
free(bufmgr_dumb->device_name);
fail_get_cap:
fail_get_device_name:
- if (tbm_drm_helper_get_master_fd() >= 0)
+ if (set_master)
tbm_drm_helper_unset_tbm_master_fd();
- else
- tbm_drm_helper_unset_fd();
+ tbm_drm_helper_unset_fd();
if (bufmgr_dumb->fd >= 0)
close(bufmgr_dumb->fd);
fail_get_auth_info: