Bug 283509 OOM crasher [@ mozEnglishWordUtils::FromRootForm]

patch by dewildt@gmail.com r=timeless sr=mscott a=chofmann
This commit is contained in:
timeless%mozdev.org 2005-06-24 16:19:54 +00:00
parent 14bcea2092
commit b42edae703

View File

@ -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]);