Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/cart/crt_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,13 @@ crt_str_to_provider(const char *str_provider)
if (len > strlen(CRT_UCX_STR) && strchr(str_provider, '+')) {
D_STRNDUP(p, str_provider, len);
if (!p) {
/* Return provider unknown if allocation fails. */
return prov;
} else {
/* Store the default UCX provider string in the alt_str
* to allow it to be restored if finalize is called.
*/
crt_na_dict[i].nad_alt_str = crt_na_dict[i].nad_str;
crt_na_dict[i].nad_str = p;
crt_na_dict[i].nad_str_alloc = true;
}
Expand Down Expand Up @@ -1071,8 +1076,12 @@ crt_finalize(void)
}

for (i = 0; crt_na_dict[i].nad_str != NULL; i++)
if (crt_na_dict[i].nad_str_alloc)
if (crt_na_dict[i].nad_str_alloc) {
D_FREE(crt_na_dict[i].nad_str);
crt_na_dict[i].nad_str = crt_na_dict[i].nad_alt_str;
crt_na_dict[i].nad_alt_str = NULL;
crt_na_dict[i].nad_str_alloc = false;
}

D_FREE(crt_gdata.cg_secondary_provs);
D_FREE(crt_gdata.cg_prov_gdata_secondary);
Expand Down
Loading