From 46ddd85c50353a35118f8544d14b566e3c95a05a Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Tue, 15 Jun 2021 13:20:42 +0900 Subject: [PATCH] tbm_module: check the bufmgr_func symbol at tbm_module_bufmgr_get_capabilities This avoids a crash when the bufmgr_funcs does not have a symbol. Change-Id: I27109d06403d974629badf17bc6ed8eb49cfd6cb --- src/tbm_module.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tbm_module.c b/src/tbm_module.c index 1df44a8..d561406 100644 --- a/src/tbm_module.c +++ b/src/tbm_module.c @@ -461,6 +461,7 @@ int tbm_module_bufmgr_get_capabilities(tbm_module *module, tbm_error_e *error) { int capabilities = 0; + tbm_backend_bufmgr_func *bufmgr_func = NULL; TBM_RETURN_VAL_SET_ERR_IF_FAIL(module, TBM_BUFMGR_CAPABILITY_NONE, *error, TBM_ERROR_INVALID_PARAMETER); @@ -469,11 +470,16 @@ tbm_module_bufmgr_get_capabilities(tbm_module *module, tbm_error_e *error) capabilities = hal_tbm_bufmgr_get_capabilities(module->hal_bufmgr, (hal_tbm_error *)error); break; case TBM_MODULE_TYPE_TBM_BACKEND: + bufmgr_func = module->bufmgr_func; + TBM_RETURN_VAL_SET_ERR_IF_FAIL(bufmgr_func, 0, *error, TBM_ERROR_INVALID_OPERATION); + TBM_RETURN_VAL_SET_ERR_IF_FAIL(bufmgr_func->bufmgr_get_capabilities, 0, *error, TBM_ERROR_NOT_SUPPORTED); + capabilities = module->bufmgr_func->bufmgr_get_capabilities(module->bufmgr_data, error); break; case TBM_MODULE_TYPE_BUFMGR_BACKEND: TBM_WRN("!!WARNING: This backend interface will be DEPRECATED after Tizen 7.0."); TBM_ERR("Do not support at tbm_bufmgr_backend."); + *error = TBM_ERROR_NOT_SUPPORTED; break; default: -- 2.7.4