From 6499986fa4d23864148f09084db9f0184018b62c Mon Sep 17 00:00:00 2001 From: "timeless%mozdev.org" Date: Tue, 1 Mar 2005 02:08:41 +0000 Subject: [PATCH] Bug 283519 OOM mlk [@ workbuf_extend] patch by ajschult@verizon.net r=roc sr=roc --- intl/unicharutil/src/nsUnicodeNormalizer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/intl/unicharutil/src/nsUnicodeNormalizer.cpp b/intl/unicharutil/src/nsUnicodeNormalizer.cpp index e239c307044..357081f1e97 100644 --- a/intl/unicharutil/src/nsUnicodeNormalizer.cpp +++ b/intl/unicharutil/src/nsUnicodeNormalizer.cpp @@ -630,8 +630,13 @@ workbuf_extend(workbuf_t *wb) { wb->ucs = (PRUint32*)nsMemory::Realloc(wb->ucs, sizeof(wb->ucs[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); + } else return (NS_OK); }