diff --git a/icu4c/source/i18n/regexcmp.cpp b/icu4c/source/i18n/regexcmp.cpp index 33d40750a1..c89f7eb3d9 100644 --- a/icu4c/source/i18n/regexcmp.cpp +++ b/icu4c/source/i18n/regexcmp.cpp @@ -307,6 +307,11 @@ void RegexCompile::compile( // int32_t numSets = fRXPat->fSets->size(); fRXPat->fSets8 = new Regex8BitSet[numSets]; + // Null pointer check. + if (fRXPat->fSets8 == NULL) { + e = *fStatus = U_MEMORY_ALLOCATION_ERROR; + return; + } int32_t i; for (i=0; ifSets->elementAt(i);