diff options
author | Junkyeong Kim <jk0430.kim@samsung.com> | 2020-08-27 15:29:06 +0900 |
---|---|---|
committer | Junkyeong Kim <jk0430.kim@samsung.com> | 2020-08-27 15:29:23 +0900 |
commit | 41bc1379d3212bf19826c7027508aa9bada6fe58 (patch) | |
tree | d11c44f56072a3a44b335e3659c410abffe7e6bf | |
parent | 08202f8ec4bfde32983027cc4c7e0a2f3417c20e (diff) | |
download | libtbm-exynos-tgm-41bc1379d3212bf19826c7027508aa9bada6fe58.tar.gz libtbm-exynos-tgm-41bc1379d3212bf19826c7027508aa9bada6fe58.tar.bz2 libtbm-exynos-tgm-41bc1379d3212bf19826c7027508aa9bada6fe58.zip |
fix fd leak
Change-Id: I74faed4c6e319f69d0d5740764e6bd2faec25bfd
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
-rw-r--r-- | src/tbm_bufmgr_exynos.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tbm_bufmgr_exynos.c b/src/tbm_bufmgr_exynos.c index 2936c04..2f4de92 100644 --- a/src/tbm_bufmgr_exynos.c +++ b/src/tbm_bufmgr_exynos.c @@ -2036,6 +2036,7 @@ tbm_exynos_init(tbm_bufmgr bufmgr, tbm_error_e *error) tbm_backend_bufmgr_func *bufmgr_func = NULL; tbm_backend_bo_func *bo_func = NULL; tbm_error_e err; + int set_master = 0; if (!bufmgr) { TBM_ERR("bufmgr is null.\n"); @@ -2065,6 +2066,7 @@ tbm_exynos_init(tbm_bufmgr bufmgr, tbm_error_e *error) if (drmIsMaster(bufmgr_exynos->fd)) { tbm_drm_helper_set_tbm_master_fd(bufmgr_exynos->fd); + set_master = 1; bufmgr_exynos->device_name = drmGetDeviceNameFromFd(bufmgr_exynos->fd); if (!bufmgr_exynos->device_name) { @@ -2199,10 +2201,9 @@ fail_alloc_bufmgr_func: if (bufmgr_exynos->hashBos) drmHashDestroy(bufmgr_exynos->hashBos); fail_init_cache_state: - 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(); fail_get_device_name: close(bufmgr_exynos->fd); fail_get_auth_info: |