Bug 211285 void nsRuleNetwork::Init doesn't check the return value of PL_DHashTableInit
r=dbaron sr=bz git-svn-id: svn://10.0.0.236/trunk@145613 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -109,13 +109,16 @@ void
|
||||
nsRuleNetwork::Init()
|
||||
{
|
||||
mNextVariable = 0;
|
||||
PL_DHashTableInit(&mSymtab, &gOps, nsnull, sizeof(SymtabEntry), PL_DHASH_MIN_SIZE);
|
||||
if (!PL_DHashTableInit(&mSymtab, &gOps, nsnull,
|
||||
sizeof(SymtabEntry), PL_DHASH_MIN_SIZE))
|
||||
mSymtab.ops = nsnull;
|
||||
}
|
||||
|
||||
void
|
||||
nsRuleNetwork::Finish()
|
||||
{
|
||||
PL_DHashTableFinish(&mSymtab);
|
||||
if (mSymtab.ops)
|
||||
PL_DHashTableFinish(&mSymtab);
|
||||
|
||||
// We "own" the nodes. So it's up to us to delete 'em
|
||||
for (ReteNodeSet::Iterator node = mNodes.First(); node != mNodes.Last(); ++node)
|
||||
|
||||
@@ -1147,6 +1147,7 @@ public:
|
||||
* Assign a symbol to a variable
|
||||
*/
|
||||
void PutSymbol(const PRUnichar* aSymbol, PRInt32 aVariable) {
|
||||
if (!mSymtab.ops) return;
|
||||
NS_PRECONDITION(LookupSymbol(aSymbol) == 0, "symbol already defined");
|
||||
|
||||
SymtabEntry* entry =
|
||||
@@ -1164,6 +1165,7 @@ public:
|
||||
* Lookup the variable associated with the symbol
|
||||
*/
|
||||
PRInt32 LookupSymbol(const PRUnichar* aSymbol, PRBool aCreate = PR_FALSE) {
|
||||
if (!mSymtab.ops) return 0;
|
||||
SymtabEntry* entry =
|
||||
NS_REINTERPRET_CAST(SymtabEntry*,
|
||||
PL_DHashTableOperate(&mSymtab,
|
||||
|
||||
Reference in New Issue
Block a user