зеркало из https://github.com/mozilla/gecko-dev.git
Bug 211286 void nsContentSupportMap::Init doesn't check the return value of PL_DHashTableInit
r=dbaron sr=bz
This commit is contained in:
Родитель
8ea554ebaa
Коммит
219eb03947
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче