diff --git a/icu4c/source/common/uloc.cpp b/icu4c/source/common/uloc.cpp index 397d813e54e..751d613322f 100644 --- a/icu4c/source/common/uloc.cpp +++ b/icu4c/source/common/uloc.cpp @@ -2371,10 +2371,14 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult } } uprv_sortArray(items.getAlias(), n, sizeof(items[0]), uloc_acceptLanguageCompare, NULL, TRUE, status); - LocalArray strs(new const char*[n], *status); - if(U_FAILURE(*status)) { - return -1; - } + if (U_FAILURE(*status)) { + return -1; + } + LocalMemory strs(NULL); + if (strs.allocateInsteadAndReset(n) == NULL) { + *status = U_MEMORY_ALLOCATION_ERROR; + return -1; + } for(i=0;i q <%g>\n", i, j[i].locale, j[i].q);*/