Bug 211284 SetOrRemoveObject doesn't check the return value of PL_DHashTableInit
r=alecf sr=dbaron git-svn-id: svn://10.0.0.236/trunk@144847 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
77aea2f7b3
commit
ca3fa847d6
@ -297,14 +297,16 @@ RemoveObjectEntry(PLDHashTable& table, nsISupports* aKey)
|
||||
static nsresult
|
||||
SetOrRemoveObject(PLDHashTable& table, nsISupports* aKey, nsISupports* aValue)
|
||||
{
|
||||
// lazily create the table, but don't create it just to remove a
|
||||
// non-existent element!
|
||||
if (!table.ops && aValue)
|
||||
PL_DHashTableInit(&table, &ObjectTableOps, nsnull,
|
||||
sizeof(ObjectEntry), 16);
|
||||
|
||||
if (aValue)
|
||||
if (aValue) {
|
||||
// lazily create the table, but only when adding elements
|
||||
if (!table.ops &&
|
||||
!PL_DHashTableInit(&table, &ObjectTableOps, nsnull,
|
||||
sizeof(ObjectEntry), 16)) {
|
||||
table.ops = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
return AddObjectEntry(table, aKey, aValue);
|
||||
}
|
||||
|
||||
// no value, so remove the key from the table
|
||||
if (table.ops)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user