summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangyeon Lee <cyeon.lee@samsung.com>2020-07-21 20:09:59 +0900
committerChangyeon Lee <cyeon.lee@samsung.com>2020-07-21 20:09:59 +0900
commitce7420d64f031279b1b01418d63cb896baadc553 (patch)
treee877d9e1fb898b5197e9ce17e960b516e842b33a
parent32b0934b906c43a84bcb7a10858d83930f13228e (diff)
downloadlibtbm-vigs-ce7420d64f031279b1b01418d63cb896baadc553.tar.gz
libtbm-vigs-ce7420d64f031279b1b01418d63cb896baadc553.tar.bz2
libtbm-vigs-ce7420d64f031279b1b01418d63cb896baadc553.zip
fix fd leak
Change-Id: I14dc83016110982c205a185246b7c20731bb4835
-rwxr-xr-xsrc/tbm_bufmgr_vigs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tbm_bufmgr_vigs.c b/src/tbm_bufmgr_vigs.c
index 7cc4957..e72e4f1 100755
--- a/src/tbm_bufmgr_vigs.c
+++ b/src/tbm_bufmgr_vigs.c
@@ -804,6 +804,7 @@ tbm_vigs_init(tbm_bufmgr bufmgr, tbm_error_e *error)
int drm_fd = -1;
tbm_error_e err;
char buf[STRERR_BUFSIZE];
+ int set_master;
TBM_DBG("enter");
@@ -835,6 +836,7 @@ tbm_vigs_init(tbm_bufmgr bufmgr, tbm_error_e *error)
if (drmIsMaster(drm_fd)) {
tbm_drm_helper_set_tbm_master_fd(drm_fd);
+ set_master = 1;
TBM_INFO("This is Master FD(%d) from open_drm.", drm_fd);
} else {
/* close the fd and get the authenticated fd from the master fd */
@@ -933,7 +935,7 @@ fail_register_bufmgr_func:
fail_alloc_bufmgr_func:
vigs_drm_device_destroy(drm_dev);
fail_create_vigs_drm_device:
- if (tbm_drm_helper_get_master_fd() >= 0)
+ if (set_master)
tbm_drm_helper_unset_tbm_master_fd();
if (drm_fd >= 0)
close(drm_fd);