Bug 283519 OOM mlk [@ workbuf_extend]

patch by ajschult@verizon.net r=roc sr=roc
This commit is contained in:
timeless%mozdev.org 2005-03-01 02:08:41 +00:00
Родитель 143e99dc98
Коммит 6499986fa4
1 изменённых файлов: 6 добавлений и 1 удалений

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

@ -630,8 +630,13 @@ workbuf_extend(workbuf_t *wb) {
wb->ucs = (PRUint32*)nsMemory::Realloc(wb->ucs, sizeof(wb->ucs[0]) * newsize); wb->ucs = (PRUint32*)nsMemory::Realloc(wb->ucs, sizeof(wb->ucs[0]) * newsize);
wb->cclass = (PRInt32*)nsMemory::Realloc(wb->cclass, sizeof(wb->cclass[0]) * newsize); wb->cclass = (PRInt32*)nsMemory::Realloc(wb->cclass, sizeof(wb->cclass[0]) * newsize);
} }
if (wb->ucs == NULL || wb->cclass == NULL) if (wb->ucs == NULL || wb->cclass == NULL) {
if (wb->ucs)
nsMemory::Free(wb->ucs);
if (wb->cclass)
nsMemory::Free(wb->cclass);
return (NS_ERROR_OUT_OF_MEMORY); return (NS_ERROR_OUT_OF_MEMORY);
}
else else
return (NS_OK); return (NS_OK);
} }