From: Markus Scherer Date: Fri, 16 Feb 2018 22:32:05 +0000 (+0000) Subject: ICU-11955 return nullptr without dereferencing when out-of-memory X-Git-Tag: release-61-rc~78 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c9d3abe36fd34a8d9c45f0470250cdc44c572010;p=icu ICU-11955 return nullptr without dereferencing when out-of-memory X-SVN-Rev: 40943 --- diff --git a/icu4c/source/common/rbbi.cpp b/icu4c/source/common/rbbi.cpp index c9f26ac9ce0..c20183505e1 100644 --- a/icu4c/source/common/rbbi.cpp +++ b/icu4c/source/common/rbbi.cpp @@ -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. diff --git a/icu4c/source/i18n/ucol_res.cpp b/icu4c/source/i18n/ucol_res.cpp index 0f1d6d23b13..76975ecc01d 100644 --- a/icu4c/source/i18n/ucol_res.cpp +++ b/icu4c/source/i18n/ucol_res.cpp @@ -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(); }