Bug 283533 OOM crash [@ XPCIDispatchClassInfo::GetInterfaces]

patch by b.jacques@planet.nl r=shaver sr=shaver a=bsmedberg
This commit is contained in:
timeless%mozdev.org 2005-07-06 17:47:27 +00:00
Родитель 6c5c70ee0b
Коммит f2679e0b87
1 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -64,14 +64,20 @@ void XPCIDispatchClassInfo::FreeSingleton()
NS_IMETHODIMP
XPCIDispatchClassInfo::GetInterfaces(PRUint32 *count, nsIID * **array)
{
*count = 1;
*array = NS_STATIC_CAST(nsIID**, nsMemory::Alloc(1 * sizeof(nsIID*)));
if(!*array)
return NS_ERROR_OUT_OF_MEMORY;
*count = 0;
*array = NS_STATIC_CAST(nsIID**, nsMemory::Alloc(sizeof(nsIID*)));
NS_ENSURE_TRUE(*array, NS_ERROR_OUT_OF_MEMORY);
**array = NS_STATIC_CAST(nsIID *, nsMemory::Clone(&NSID_IDISPATCH,
sizeof(NSID_IDISPATCH)));
if(!**array)
{
nsMemory::Free(*array);
*array = nsnull;
return NS_ERROR_OUT_OF_MEMORY;
}
*count = 1;
return NS_OK;
}