tbm_bufmgr: donot call _tbm_set_last_result 20/260320/1
authorSooChan Lim <sc1.lim@samsung.com>
Wed, 23 Jun 2021 05:26:14 +0000 (14:26 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 23 Jun 2021 07:14:07 +0000 (16:14 +0900)
The caller of tbm_bufmgr_internal_alloc_bo_with_format calls
_tbm_set_last_result with the error value.

Change-Id: If64031796a5a35b5c811ba2da614674ea6510ef3

src/tbm_bufmgr.c

index ac57df7..aecf23d 100644 (file)
@@ -923,7 +923,6 @@ tbm_bufmgr_internal_alloc_bo_with_format(tbm_bufmgr bufmgr, int format, int bo_i
        tbm_bo bo = NULL;
 
        _tbm_bufmgr_mutex_lock();
-       _tbm_set_last_result(TBM_ERROR_NONE);
 
        TBM_BUFMGR_RETURN_VAL_IF_FAIL(TBM_BUFMGR_IS_VALID(bufmgr), NULL);
 
@@ -933,17 +932,19 @@ tbm_bufmgr_internal_alloc_bo_with_format(tbm_bufmgr bufmgr, int format, int bo_i
        if (!bo) {
                /* LCOV_EXCL_START */
                TBM_ERR("memory allocationc failed.");
-               _tbm_set_last_result(TBM_ERROR_OUT_OF_MEMORY);
+               *error = TBM_ERROR_OUT_OF_MEMORY;
+               _tbm_bufmgr_mutex_unlock();
+               return NULL;
                /* LCOV_EXCL_STOP */
-               goto fail;
        }
 
        bo->bo_data = tbm_module_alloc_bo_data_with_format(bufmgr->module, format, bo_idx, width, height, bpp, flags, error);
        if (!bo->bo_data) {
                /* LCOV_EXCL_START */
-               _tbm_set_last_result(*error);
+               free(bo);
+               _tbm_bufmgr_mutex_unlock();
+               return NULL;
                /* LCOV_EXCL_STOP */
-               goto fail;
        }
 
        _tbm_bufmgr_initialize_bo(bufmgr, bo, flags);
@@ -951,13 +952,12 @@ tbm_bufmgr_internal_alloc_bo_with_format(tbm_bufmgr bufmgr, int format, int bo_i
        _tbm_bufmgr_mutex_unlock();
 
        return bo;
-
+/* LCOV_EXCL_START */
 fail:
-       if (bo)
-               free(bo);
        _tbm_bufmgr_mutex_unlock();
 
        return NULL;
+/* LCOV_EXCL_STOP */
 }
 
 tbm_bo