X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..ef6cf650f4a75c3f97de06b51fa104f2069b9ea2:/icuSources/layout/MPreFixups.cpp diff --git a/icuSources/layout/MPreFixups.cpp b/icuSources/layout/MPreFixups.cpp index 75791eed..08ad7a75 100644 --- a/icuSources/layout/MPreFixups.cpp +++ b/icuSources/layout/MPreFixups.cpp @@ -1,6 +1,6 @@ /* * - * (C) Copyright IBM Corp. 2002-2004 - All Rights Reserved + * (C) Copyright IBM Corp. 2002-2008 - All Rights Reserved * */ @@ -40,8 +40,12 @@ void MPreFixups::add(le_int32 baseIndex, le_int32 mpreIndex) } } -void MPreFixups::apply(LEGlyphStorage &glyphStorage) +void MPreFixups::apply(LEGlyphStorage &glyphStorage, LEErrorCode& success) { + if (LE_FAILURE(success)) { + return; + } + for (le_int32 fixup = 0; fixup < fFixupCount; fixup += 1) { le_int32 baseIndex = fFixupData[fixup].fBaseIndex; le_int32 mpreIndex = fFixupData[fixup].fMPreIndex; @@ -65,6 +69,14 @@ void MPreFixups::apply(LEGlyphStorage &glyphStorage) le_int32 mpreDest = baseIndex - mpreCount; LEGlyphID *mpreSave = LE_NEW_ARRAY(LEGlyphID, mpreCount); le_int32 *indexSave = LE_NEW_ARRAY(le_int32, mpreCount); + + if (mpreSave == NULL || indexSave == NULL) { + LE_DELETE_ARRAY(mpreSave); + LE_DELETE_ARRAY(indexSave); + success = LE_MEMORY_ALLOCATION_ERROR; + return; + } + le_int32 i; for (i = 0; i < mpreCount; i += 1) {