Skip to content

Commit

Permalink
rest_vol: (fix) Return variable and GCPL_buf
Browse files Browse the repository at this point in the history
- Change return value to FAIL in the case the filepath cannot be
  allocated. The NULL value is not allowed when using Intel OneAPI
  C compiler.
- Ensure that freeing GCPL_buf is only done when it is allocated.
  • Loading branch information
Jan-Willem Blokland authored and Jan-Willem Blokland committed Nov 20, 2023
1 parent 039828c commit a151c54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rest_vol.c
Original file line number Diff line number Diff line change
Expand Up @@ -2530,7 +2530,7 @@ RV_copy_object_loc_info_callback(char *HTTP_response, void *callback_data_in, vo

/* Allocate root "path" on heap for consistency with other RV_object_t types */
if ((new_domain->handle_path = RV_malloc(2)) == NULL)
FUNC_GOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "can't allocate space for filepath");
FUNC_GOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate space for filepath");

strncpy(new_domain->handle_path, "/", 2);

Expand All @@ -2552,7 +2552,7 @@ RV_copy_object_loc_info_callback(char *HTTP_response, void *callback_data_in, vo
if (parse_tree)
yajl_tree_free(parse_tree);

if (ret_value < 0) {
if ((ret_value < 0) && GCPL_buf) {
RV_free(GCPL_buf);
GCPL_buf = NULL;
loc_info_out->GCPL_base64 = NULL;
Expand Down Expand Up @@ -3825,4 +3825,4 @@ RV_free_visited_link_hash_table_key(rv_hash_table_key_t value)
{
RV_free(value);
value = NULL;
} /* end RV_free_visited_link_hash_table_key() */
} /* end RV_free_visited_link_hash_table_key() */

0 comments on commit a151c54

Please sign in to comment.