Bug 393630 - "Potential crash on oom in GenerateAlternativeString" [p=masayuki@d-toybox.com (Masayuki Nakano) r=stuart a1.9=damons]

This commit is contained in:
reed@reedloden.com 2007-10-19 01:10:28 -07:00
parent 708ae9b606
commit ce7094da13

View File

@ -1443,6 +1443,8 @@ private:
if (mAlternativeString) if (mAlternativeString)
free(mAlternativeString); free(mAlternativeString);
mAlternativeString = (PRUnichar *)malloc(mRangeLength * sizeof(PRUnichar)); mAlternativeString = (PRUnichar *)malloc(mRangeLength * sizeof(PRUnichar));
if (!mAlternativeString)
return;
memcpy((void *)mAlternativeString, (const void *)mRangeString, memcpy((void *)mAlternativeString, (const void *)mRangeString,
mRangeLength * sizeof(PRUnichar)); mRangeLength * sizeof(PRUnichar));
for (PRUint32 i = 0; i < mRangeLength; i++) { for (PRUint32 i = 0; i < mRangeLength; i++) {