From c2e3112302296d50e837880035a8445b75a9b4c5 Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Thu, 11 Mar 2021 17:42:42 +0900 Subject: [PATCH] Tdm_bo: Add null checking before use Change-Id: I1b780b2eaeaac3cbf316156475a217f0628bef26 Signed-off-by: Junkyeong Kim --- src/tbm_bo.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/tbm_bo.c b/src/tbm_bo.c index eb188f1..b5d5b53 100644 --- a/src/tbm_bo.c +++ b/src/tbm_bo.c @@ -464,8 +464,9 @@ tbm_bo_alloc_with_format(tbm_bufmgr bufmgr, int format, int bo_idx, int width, if (ret != HAL_TBM_ERROR_NONE) { if (ret != HAL_TBM_ERROR_NOT_SUPPORTED) { TBM_ERR("error: fail to tbm_bo_alloc_with_format\n"); + if (error) + _tbm_set_last_result(*error); } - _tbm_set_last_result(*error); goto bo_alloc_fail; } } else { @@ -474,7 +475,8 @@ tbm_bo_alloc_with_format(tbm_bufmgr bufmgr, int format, int bo_idx, int width, if (!bo_data) { TBM_ERR("error: fail to tbm_bo_alloc_with_format fmt(%s) idx(%d) w(%d) h(%d) mem_types(%s)\n", FOURCC_STR(format), bo_idx, width, height, _tbm_flag_to_str(flags)); - _tbm_set_last_result(*error); + if (error) + _tbm_set_last_result(*error); goto bo_alloc_fail; } } @@ -534,8 +536,9 @@ tbm_bo_alloc_with_tiled_format(tbm_bufmgr bufmgr, int width, int height, int bpp if (ret != HAL_TBM_ERROR_NOT_SUPPORTED) { TBM_ERR("error: fail to tbm_bo_alloc_with_tiled_format fmt(%s) idx(%d) w(%d) h(%d) flags(%s)\n", FOURCC_STR(format), bo_idx, width, height, _tbm_flag_to_str(flags)); + if (error) + _tbm_set_last_result(*error); } - _tbm_set_last_result(*error); goto bo_alloc_fail; } } else { @@ -544,7 +547,8 @@ tbm_bo_alloc_with_tiled_format(tbm_bufmgr bufmgr, int width, int height, int bpp if (!bo_data) { TBM_ERR("error: fail to tbm_bo_alloc_with_tiled_format fmt(%s) idx(%d) w(%d) h(%d) flags(%s)\n", FOURCC_STR(format), bo_idx, width, height, _tbm_flag_to_str(flags)); - _tbm_set_last_result(*error); + if (error) + _tbm_set_last_result(*error); goto bo_alloc_fail; } } -- 2.7.4