diff options
author | Changyeon Lee <cyeon.lee@samsung.com> | 2020-07-21 20:04:27 +0900 |
---|---|---|
committer | Changyeon Lee <cyeon.lee@samsung.com> | 2020-07-21 20:06:26 +0900 |
commit | 26da13d2efc3821513264df96b3b3ca8ad2b0c72 (patch) | |
tree | a5637408dbaf659274e81a4bfab2c003e0793f2a | |
parent | b601598ddd1220fad46845f80c5457670977f25b (diff) | |
download | libtbm-vc4-26da13d2efc3821513264df96b3b3ca8ad2b0c72.tar.gz libtbm-vc4-26da13d2efc3821513264df96b3b3ca8ad2b0c72.tar.bz2 libtbm-vc4-26da13d2efc3821513264df96b3b3ca8ad2b0c72.zip |
fix fd leak
Change-Id: Ife4e41a03b753264c45314a9248196cb2e6f3fe5
-rw-r--r-- | src/tbm_bufmgr_vc4.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tbm_bufmgr_vc4.c b/src/tbm_bufmgr_vc4.c index 690a4ae..c8a436e 100644 --- a/src/tbm_bufmgr_vc4.c +++ b/src/tbm_bufmgr_vc4.c @@ -2185,6 +2185,7 @@ tbm_vc4_init(tbm_bufmgr bufmgr, tbm_error_e *error) tbm_backend_bo_func *bo_func = NULL; int fp; tbm_error_e err; + int set_master = 0; if (!bufmgr) { TBM_ERR("bufmgr is null.\n"); @@ -2213,6 +2214,7 @@ tbm_vc4_init(tbm_bufmgr bufmgr, tbm_error_e *error) } if (drmIsMaster(bufmgr_vc4->fd)) { tbm_drm_helper_set_tbm_master_fd(bufmgr_vc4->fd); + set_master = 1; bufmgr_vc4->device_name = drmGetDeviceNameFromFd(bufmgr_vc4->fd); if (!bufmgr_vc4->device_name) { @@ -2361,10 +2363,9 @@ fail_alloc_bufmgr_func: if (bufmgr_vc4->hashBos) drmHashDestroy(bufmgr_vc4->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_vc4->fd); fail_get_auth_info: |