Bug 504453 nsAttrAndChildArray::GrowBy worries coverity

r=sicking sr=sicking
This commit is contained in:
timeless@mozdev.org 2009-07-22 17:31:01 -05:00
Родитель 267275b06b
Коммит c0dcc2949e
1 изменённых файлов: 3 добавлений и 5 удалений

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

@ -768,16 +768,14 @@ nsAttrAndChildArray::GrowBy(PRUint32 aGrowSize)
size = PR_BIT(PR_CeilingLog2(minSize));
}
Impl* newImpl = static_cast<Impl*>
(mImpl ? PR_Realloc(mImpl, size * sizeof(void*)) :
PR_Malloc(size * sizeof(void*)));
PRBool needToInitialize = !mImpl;
Impl* newImpl = static_cast<Impl*>(PR_Realloc(mImpl, size * sizeof(void*)));
NS_ENSURE_TRUE(newImpl, PR_FALSE);
Impl* oldImpl = mImpl;
mImpl = newImpl;
// Set initial counts if we didn't have a buffer before
if (!oldImpl) {
if (needToInitialize) {
mImpl->mMappedAttrs = nsnull;
SetAttrSlotAndChildCount(0, 0);
}