- bo_data_array = calloc(*num_bos, sizeof(struct _tbm_bo_data));
- if (bo_data_array) {
- TBM_ERR("memory allocation failed.");
- *error = TBM_ERROR_OUT_OF_MEMORY;
- return NULL;
+ bo_data_array = calloc(*num_bos, sizeof(tbm_bo_data *));
+ TBM_RETURN_VAL_IF_FAIL(bo_data_array, NULL);
+
+ for (i = 0; i < *num_bos; i++) {
+ bo_data_array[i] = calloc(*num_bos, sizeof(struct _tbm_bo_data));
+ TBM_GOTO_VAL_SET_ERR_IF_FAIL(bo_data_array[i], failed, *error, TBM_ERROR_OUT_OF_MEMORY);