ICU-11955 return nullptr without dereferencing when out-of-memory
X-SVN-Rev: 40943
This commit is contained in:
parent
ba64bead00
commit
c9d3abe36f
@ -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.
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user