ICU-12652 better fix, see r39114

X-SVN-Rev: 39115
This commit is contained in:
Steven R. Loomis 2016-08-31 23:37:29 +00:00
parent 93180d2d73
commit d9babe5948

View file

@ -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<const char*> strs(new const char*[n], *status);
if(U_FAILURE(*status)) {
return -1;
}
if (U_FAILURE(*status)) {
return -1;
}
LocalMemory<const char*> strs(NULL);
if (strs.allocateInsteadAndReset(n) == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
return -1;
}
for(i=0;i<n;i++) {
#if defined(ULOC_DEBUG)
/*fprintf(stderr,"%d: s <%s> q <%g>\n", i, j[i].locale, j[i].q);*/