From daaf0196e1f27cd674a9963557cc7958884869c2 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Wed, 5 Jan 2022 12:44:52 +0900 Subject: [PATCH] tbm_surface_internal: fix wrong last result when tbm_bo_map is failed tbm_bo_unmap set ERROR NONE to last result in case of tbm_bo_map is failed Change-Id: I160d38ebd07020b7b1a5766eacaab7d40c8bb69e --- src/tbm_surface_internal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tbm_surface_internal.c b/src/tbm_surface_internal.c index c365f77..7b714ee 100644 --- a/src/tbm_surface_internal.c +++ b/src/tbm_surface_internal.c @@ -1387,6 +1387,7 @@ tbm_surface_internal_get_info(tbm_surface_h surface, int opt, tbm_bo bos[4]; int planes_bo_idx[TBM_SURF_PLANE_MAX]; int i, j; + tbm_error_e error; _tbm_surface_mutex_lock(); _tbm_set_last_result(TBM_ERROR_NONE); @@ -1422,9 +1423,11 @@ tbm_surface_internal_get_info(tbm_surface_h surface, int opt, for (i = 0; i < num_bos; i++) { bo_handles[i] = tbm_bo_map(bos[i], TBM_DEVICE_CPU, opt); if (bo_handles[i].ptr == NULL) { + error = tbm_get_last_error(); for (j = 0; j < i; j++) tbm_bo_unmap(bos[j]); + _tbm_set_last_result(error); TBM_ERR("error: tbm_surface(%p) opt(%d) map(%d)\n", surface, opt, map); return 0; } -- 2.7.4