Skip to content

Commit

Permalink
Fix segfault on VOL termination (#100)
Browse files Browse the repository at this point in the history
* Initialize global type array ptr to NULL
  • Loading branch information
mattjala authored Nov 10, 2023
1 parent 042df35 commit ecbbb8c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/rest_vol.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ typedef struct H5_rest_ad_info_t {
} H5_rest_ad_info_t;

/* Global array containing information about open objects */
RV_type_info *RV_type_info_array_g[H5I_MAX_NUM_TYPES];
RV_type_info *RV_type_info_array_g[H5I_MAX_NUM_TYPES] = {0};

/* Host header string for specifying the host (Domain) for requests */
const char *const host_string = "X-Hdf-domain: ";
Expand Down Expand Up @@ -629,11 +629,16 @@ H5_rest_term(void)
} /* end if */

/* Cleanup type info array */
for (size_t i = 0; i < H5I_MAX_NUM_TYPES; i++) {
rv_hash_table_free(RV_type_info_array_g[i]->table);
RV_free(RV_type_info_array_g[i]);
RV_type_info_array_g[i] = NULL;
if (RV_type_info_array_g) {
for (size_t i = 0; i < H5I_MAX_NUM_TYPES; i++) {
if (RV_type_info_array_g[i]) {
rv_hash_table_free(RV_type_info_array_g[i]->table);
RV_free(RV_type_info_array_g[i]);
RV_type_info_array_g[i] = NULL;
}
}
}

/*
* "Forget" connector ID. This should normally be called by the library
* when it is closing the id, so no need to close it here.
Expand Down

0 comments on commit ecbbb8c

Please sign in to comment.