]> granicus.if.org Git - icu/commitdiff
ICU-11955 return nullptr without dereferencing when out-of-memory
authorMarkus Scherer <markus.icu@gmail.com>
Fri, 16 Feb 2018 22:32:05 +0000 (22:32 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Fri, 16 Feb 2018 22:32:05 +0000 (22:32 +0000)
X-SVN-Rev: 40943

icu4c/source/common/rbbi.cpp
icu4c/source/i18n/ucol_res.cpp

index c9f26ac9ce0bc5e67b1d11cae9cb6fbd6df18ad0..c20183505e117e2a309b8d12fbaa7d9ee029ff1f 100644 (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.
index 0f1d6d23b132aec13689105f8424c6dbbbc07f3f..76975ecc01de638af22f6028c699ccbb3897f9e4 100644 (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();
     }