зеркало из https://github.com/mozilla/pjs.git
Null check after malloc in currently-unused osxspell component. b=283516 r=smorgan
This commit is contained in:
Родитель
a09b9e1593
Коммит
a24f740e76
|
@ -115,8 +115,9 @@ NS_IMETHODIMP mozOSXSpell::GetLanguage(PRUnichar **aLanguage)
|
|||
}
|
||||
mLanguage.Assign(*aLanguage);
|
||||
}
|
||||
else
|
||||
else {
|
||||
*aLanguage = ToNewUnicode(mLanguage);
|
||||
}
|
||||
|
||||
return *aLanguage ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -299,6 +300,8 @@ NS_IMETHODIMP mozOSXSpell::Suggest(const PRUnichar *aWord, PRUnichar ***aSuggest
|
|||
|
||||
PRUint32 length = [self length];
|
||||
PRUnichar* retStr = (PRUnichar*)nsMemory::Alloc((length + 1) * sizeof(PRUnichar));
|
||||
if (!retStr)
|
||||
return NULL;
|
||||
[self getCharacters:retStr];
|
||||
retStr[length] = PRUnichar(0);
|
||||
return retStr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче