From: Junkyeong Kim Date: Tue, 2 Mar 2021 01:15:27 +0000 (+0900) Subject: tbm_surface_internal: check bufmgr init success before list init X-Git-Tag: submit/tizen/20210316.103642~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F254380%2F2;p=platform%2Fcore%2Fuifw%2Flibtbm.git tbm_surface_internal: check bufmgr init success before list init Change-Id: I4b18a5b8375146d7518665d871585d8b8613027a Signed-off-by: Junkyeong Kim --- diff --git a/src/tbm_surface_internal.c b/src/tbm_surface_internal.c index df57c42..c104298 100644 --- a/src/tbm_surface_internal.c +++ b/src/tbm_surface_internal.c @@ -630,6 +630,11 @@ tbm_surface_internal_query_supported_formats(uint32_t **formats, if (!g_surface_bufmgr) { _init_surface_bufmgr(); + if (!g_surface_bufmgr) { + TBM_ERR("fail bufmgr initialization\n"); + _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION); + goto fail; + } LIST_INITHEAD(&g_surface_bufmgr->surf_list); bufmgr_initialized = true; } @@ -770,6 +775,11 @@ tbm_surface_internal_create_with_flags(int width, int height, if (!g_surface_bufmgr) { _init_surface_bufmgr(); + if (!g_surface_bufmgr) { + TBM_ERR("fail bufmgr initialization\n"); + _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION); + goto check_valid_fail; + } LIST_INITHEAD(&g_surface_bufmgr->surf_list); bufmgr_initialized = true; } @@ -777,6 +787,7 @@ tbm_surface_internal_create_with_flags(int width, int height, bufmgr = g_surface_bufmgr; if (!TBM_BUFMGR_IS_VALID(bufmgr)) { TBM_ERR("The bufmgr is invalid\n"); + _tbm_set_last_result(TBM_ERROR_INVALID_PARAMETER); goto check_valid_fail; } @@ -965,6 +976,11 @@ tbm_surface_internal_create_with_bos(tbm_surface_info_s *info, if (!g_surface_bufmgr) { _init_surface_bufmgr(); + if (!g_surface_bufmgr) { + TBM_ERR("fail bufmgr initialization\n"); + _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION); + goto check_valid_fail; + } LIST_INITHEAD(&g_surface_bufmgr->surf_list); bufmgr_initialized = true; }