From: SooChan Lim Date: Fri, 30 Apr 2021 07:03:46 +0000 (+0900) Subject: tbm_bo: free hal_tbm_bo when it is allocated by tbm_bo_alloc X-Git-Tag: submit/tizen/20210608.001159^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Flibtbm.git;a=commitdiff_plain;h=c88488bbe37b25b7f662c21ed27e7cd1036d0c8a tbm_bo: free hal_tbm_bo when it is allocated by tbm_bo_alloc The hal_tbm_do which is allocated by tbm_bo_alloc_with_tbm_backend_data is not freed at this _tbm_bo_free. The hal_tbm_bo from hal_tbm_surface will be and should be freed at the hal-tbm-api backend module. Change-Id: Ie10ecc370d1365a2c4a1067d3295d3fb632d7a0d --- diff --git a/src/tbm_bo.c b/src/tbm_bo.c index 044b5ec..0f2b138 100644 --- a/src/tbm_bo.c +++ b/src/tbm_bo.c @@ -384,6 +384,7 @@ tbm_bo_alloc(tbm_bufmgr bufmgr, int size, int flags) } /* LCOV_EXCL_STOP */ bo->bo_data = bo_data; + bo->allocated_hal_tbm_bo = 1; } else if (bufmgr->backend_module_data) { bo_data = bufmgr->bufmgr_func->bufmgr_alloc_bo(bufmgr->bufmgr_data, (unsigned int)size, flags, &error); if (!bo_data) { @@ -1625,8 +1626,12 @@ _tbm_bo_free(tbm_bo bo) /* call the bo_free */ if (bo->bufmgr->use_hal_tbm) { - hal_tbm_bo_free(bo->bo_data); - bo->bo_data = NULL; + // call hal_tbm_bo_free when bo is created by tbm_bo_alloc api. + if (bo->allocated_hal_tbm_bo) { + hal_tbm_bo_free(bo->bo_data); + bo->bo_data = NULL; + bo->allocated_hal_tbm_bo = 0; + } } else if (bo->bufmgr->backend_module_data) { bo->bufmgr->bo_func->bo_free(bo->bo_data); bo->bo_data = NULL; diff --git a/src/tbm_bufmgr_int.h b/src/tbm_bufmgr_int.h index b6c97c7..0eb5f79 100644 --- a/src/tbm_bufmgr_int.h +++ b/src/tbm_bufmgr_int.h @@ -186,6 +186,7 @@ struct _tbm_bo { unsigned int map_cnt; /* device map count */ tbm_backend_bo_data *bo_data; /* bo data of the backend module */ + int allocated_hal_tbm_bo; /* this bo is by calling hal_tbm_bo_alloc */ }; /**