tbm_module: add tbm_module_bo_free and use it
[platform/core/uifw/libtbm.git] / src / tbm_bo.c
index 39aac76..8b3fd81 100644 (file)
@@ -1076,22 +1076,7 @@ _tbm_bo_free(tbm_bo bo)
                bo->lock_cnt--;
        }
 
-       /* call the bo_free */
-       if (bo->bufmgr->use_hal_tbm) {
-               // call hal_tbm_bo_free when bo is created by tbm_bo_alloc api.
-               if (!bo->get_from_hal_surface) {
-                       bo->get_from_hal_surface = 0;
-
-                       hal_tbm_bo_free(bo->bo_data);
-                       bo->bo_data = NULL;
-               }
-       } else if (bo->bufmgr->backend_module_data) {
-               bo->bufmgr->bo_func->bo_free(bo->bo_data);
-               bo->bo_data = NULL;
-       } else {
-               bo->bufmgr->backend->bo_free(bo);
-               bo->priv = NULL;
-       }
+       tbm_module_bo_free(bo->bufmgr->module, bo, bo->bo_data, bo->get_from_hal_surface);
 
        _tbm_bo_deinit(bo);