diff --git a/extensions/spellcheck/src/mozEnglishWordUtils.cpp b/extensions/spellcheck/src/mozEnglishWordUtils.cpp index e402a18c5fcf..fecada5dbaba 100644 --- a/extensions/spellcheck/src/mozEnglishWordUtils.cpp +++ b/extensions/spellcheck/src/mozEnglishWordUtils.cpp @@ -273,6 +273,10 @@ NS_IMETHODIMP mozEnglishWordUtils::FromRootForm(const PRUnichar *aWord, const PR for(PRUint32 i = 0; i < icount; ++i) { length = nsCRT::strlen(iwords[i]); tmpPtr[i] = (PRUnichar *) nsMemory::Alloc(sizeof(PRUnichar) * (length + 1)); + if (NS_UNLIKELY(!tmpPtr[i])) { + NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(i, tmpPtr); + return NS_ERROR_OUT_OF_MEMORY; + } memcpy(tmpPtr[i], iwords[i], (length + 1) * sizeof(PRUnichar)); nsAutoString capTest(tmpPtr[i]);