ICU-11955 return nullptr without dereferencing when out-of-memory

X-SVN-Rev: 40943
This commit is contained in:
Markus Scherer 2018-02-16 22:32:05 +00:00
parent ba64bead00
commit c9d3abe36f
2 changed files with 2 additions and 0 deletions

View File

@ -1305,6 +1305,7 @@ RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) {
fUnhandledBreakEngine = new UnhandledEngine(status);
if (U_SUCCESS(status) && fUnhandledBreakEngine == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return nullptr;
}
// Put it last so that scripts for which we have an engine get tried
// first.

View File

@ -451,6 +451,7 @@ CollationLoader::loadFromData(UErrorCode &errorCode) {
const CollationCacheEntry *entry = new CollationCacheEntry(validLocale, t.getAlias());
if(entry == NULL) {
errorCode = U_MEMORY_ALLOCATION_ERROR;
return nullptr;
} else {
t.orphan();
}