From 9da37f8813d9db9ba067e29c7cd2fb6d05d3ca79 Mon Sep 17 00:00:00 2001 From: "timeless%mozdev.org" Date: Tue, 5 Aug 2003 11:40:44 +0000 Subject: [PATCH] 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 --- mozilla/content/xul/templates/src/nsRuleNetwork.cpp | 7 +++++-- mozilla/content/xul/templates/src/nsRuleNetwork.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mozilla/content/xul/templates/src/nsRuleNetwork.cpp b/mozilla/content/xul/templates/src/nsRuleNetwork.cpp index 42dc92cf35a..88b56ee7d2d 100644 --- a/mozilla/content/xul/templates/src/nsRuleNetwork.cpp +++ b/mozilla/content/xul/templates/src/nsRuleNetwork.cpp @@ -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) diff --git a/mozilla/content/xul/templates/src/nsRuleNetwork.h b/mozilla/content/xul/templates/src/nsRuleNetwork.h index 7a233a5026f..0c1d6b8093d 100644 --- a/mozilla/content/xul/templates/src/nsRuleNetwork.h +++ b/mozilla/content/xul/templates/src/nsRuleNetwork.h @@ -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,