fix the memory allocation failed.
[platform/core/uifw/libtbm.git] / src / tbm_surface_internal.c
index 0618fe4..17aa777 100644 (file)
@@ -852,13 +852,11 @@ tbm_surface_internal_create_with_flags(int width, int height,
                if (bufmgr->use_hal_tbm) {
                        surf->bos[i] = tbm_bo_alloc_with_format(bufmgr, format, i, width, height, surf->info.bpp/8, flags, &error);
                        if (error == TBM_ERROR_NOT_SUPPORTED) {
-                               if (error != TBM_ERROR_NONE) {
+                               surf->bos[i] = tbm_bo_alloc(bufmgr, bo_size, flags);
+                               if (!surf->bos[i]) {
                                        TBM_ERR("fail to alloc bo idx:%d\n", i);
                                        goto alloc_bo_fail;
                                }
-                       } else if (error != TBM_ERROR_NONE) {
-                               TBM_ERR("fail to alloc bo idx:%d\n", i);
-                               goto alloc_bo_fail;
                        }
                } else if (bufmgr->backend_module_data) {
                        if (bufmgr->bufmgr_func->bufmgr_alloc_bo_with_format) {