From: Changyeon Lee Date: Thu, 3 Mar 2016 06:36:30 +0000 (+0900) Subject: Fix fd leak X-Git-Tag: accepted/tizen/mobile/20160307.015815~1^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff48e98525b0684d281efc6640a93b75e6b2718a;p=platform%2Fadaptation%2Fspreadtrum%2Flibtbm-sprd.git Fix fd leak Change-Id: Ia8d6a821b58bf2532dda86a0e9ac7d1f27299f9c --- diff --git a/src/tbm_bufmgr_sprd.c b/src/tbm_bufmgr_sprd.c index b8e8eef..63b0eb6 100755 --- a/src/tbm_bufmgr_sprd.c +++ b/src/tbm_bufmgr_sprd.c @@ -1516,14 +1516,13 @@ tbm_sprd_bufmgr_deinit (void *priv) bufmgr_sprd->hashBos = NULL; } - close (bufmgr_sprd->tgl_fd); - if (bufmgr_sprd->bind_display) tbm_drm_helper_wl_auth_server_deinit(); if (bufmgr_sprd->device_name) free(bufmgr_sprd->device_name); + close (bufmgr_sprd->tgl_fd); close (bufmgr_sprd->fd); free (bufmgr_sprd); @@ -1905,6 +1904,7 @@ init_tbm_bufmgr_priv (tbm_bufmgr bufmgr, int fd) "error: Fail to open global_lock:%s\n", getpid(), tgl_devfile); + close(bufmgr_sprd->fd); free (bufmgr_sprd); return 0; } @@ -1915,6 +1915,9 @@ init_tbm_bufmgr_priv (tbm_bufmgr bufmgr, int fd) "error: Fail to initialize the tgl\n", getpid()); + close(bufmgr_sprd->fd); + close(bufmgr_sprd->tgl_fd); + free (bufmgr_sprd); return 0; } @@ -1939,6 +1942,9 @@ init_tbm_bufmgr_priv (tbm_bufmgr bufmgr, int fd) if (!bufmgr_backend) { TBM_SPRD_LOG ("[libtbm-sprd:%d] error: Fail to create drm!\n", getpid()); + close(bufmgr_sprd->fd); + close(bufmgr_sprd->tgl_fd); + free (bufmgr_sprd); return 0; } @@ -1970,6 +1976,9 @@ init_tbm_bufmgr_priv (tbm_bufmgr bufmgr, int fd) TBM_SPRD_LOG ("[libtbm-sprd:%d] error: Fail to init backend!\n", getpid()); tbm_backend_free (bufmgr_backend); + close(bufmgr_sprd->tgl_fd); + close(bufmgr_sprd->fd); + free (bufmgr_sprd); return 0; }