Bug 211286 void nsContentSupportMap::Init doesn't check the return value of PL_DHashTableInit

r=dbaron sr=bz
This commit is contained in:
timeless%mozdev.org 2003-08-05 11:41:14 +00:00
Родитель 8ea554ebaa
Коммит 219eb03947
2 изменённых файлов: 13 добавлений и 2 удалений

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

@ -60,18 +60,23 @@ nsContentSupportMap::ClearEntry(PLDHashTable* aTable, PLDHashEntryHdr* aHdr)
void
nsContentSupportMap::Init()
{
PL_DHashTableInit(&mMap, &gOps, nsnull, sizeof(Entry), PL_DHASH_MIN_SIZE);
if (!PL_DHashTableInit(&mMap, &gOps, nsnull, sizeof(Entry), PL_DHASH_MIN_SIZE))
mMap.ops = nsnull;
}
void
nsContentSupportMap::Finish()
{
PL_DHashTableFinish(&mMap);
if (mMap.ops)
PL_DHashTableFinish(&mMap);
}
nsresult
nsContentSupportMap::Remove(nsIContent* aElement)
{
if (!mMap.ops)
return NS_ERROR_NOT_INITIALIZED;
PL_DHashTableOperate(&mMap, aElement, PL_DHASH_REMOVE);
PRInt32 count;

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

@ -60,6 +60,9 @@ public:
~nsContentSupportMap() { Finish(); }
nsresult Put(nsIContent* aElement, nsTemplateMatch* aMatch) {
if (!mMap.ops)
return NS_ERROR_NOT_INITIALIZED;
PLDHashEntryHdr* hdr = PL_DHashTableOperate(&mMap, aElement, PL_DHASH_ADD);
if (!hdr)
return NS_ERROR_OUT_OF_MEMORY;
@ -71,6 +74,9 @@ public:
return NS_OK; }
PRBool Get(nsIContent* aElement, nsTemplateMatch** aMatch) {
if (!mMap.ops)
return PR_FALSE;
PLDHashEntryHdr* hdr = PL_DHashTableOperate(&mMap, aElement, PL_DHASH_LOOKUP);
if (PL_DHASH_ENTRY_IS_FREE(hdr))
return PR_FALSE;