diff --git a/extensions/transformiix/source/base/NamedMap.cpp b/extensions/transformiix/source/base/NamedMap.cpp index 87458311377..181313b63d2 100644 --- a/extensions/transformiix/source/base/NamedMap.cpp +++ b/extensions/transformiix/source/base/NamedMap.cpp @@ -25,13 +25,13 @@ * -- fixed memory leak in NamedMap::hashKey method by deleting * up char[] chars; * - * $Id: NamedMap.cpp,v 1.5 2001-01-22 09:38:28 kvisco%ziplink.net Exp $ + * $Id: NamedMap.cpp,v 1.6 2001-04-03 12:36:04 peterv%netscape.com Exp $ */ /** * A Named Map for MITREObjects * @author Keith Visco - * @version $Revision: 1.5 $ $Date: 2001-01-22 09:38:28 $ + * @version $Revision: 1.6 $ $Date: 2001-04-03 12:36:04 $ **/ #include "NamedMap.h" @@ -190,7 +190,10 @@ MBool NamedMap::isEmpty() { * Please delete this List when you are done with it **/ StringList* NamedMap::keys() { - StringList* list = new StringList(); + StringList* list = new StringList(); + if (!list) + return NULL; + for (int i = 0; i < numberOfBuckets; i++) { BucketItem* item = elements[i]; while (item) { @@ -250,7 +253,11 @@ void NamedMap::put(const String& key, TxObject* obj) { ++numberOfElements; } //-- we found bucket item, just set value - else bktItem->item = obj; + else { + if (doObjectDeletion) + delete bktItem->item; + bktItem->item = obj; + } } } //-- put /** @@ -312,10 +319,12 @@ int NamedMap::size() { NamedMap::BucketItem* NamedMap::createBucketItem(const String& key, TxObject* objPtr) { BucketItem* bktItem = new BucketItem; - bktItem->next = 0; - bktItem->prev = 0; - bktItem->key = key; - bktItem->item = objPtr; + if (bktItem) { + bktItem->next = 0; + bktItem->prev = 0; + bktItem->key = key; + bktItem->item = objPtr; + } return bktItem; } //-- createBucketItem diff --git a/extensions/transformiix/source/xpath/PredicateList.cpp b/extensions/transformiix/source/xpath/PredicateList.cpp index 89f577deae1..77c1251d387 100644 --- a/extensions/transformiix/source/xpath/PredicateList.cpp +++ b/extensions/transformiix/source/xpath/PredicateList.cpp @@ -21,7 +21,7 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: PredicateList.cpp,v 1.1 2000-04-06 07:45:37 kvisco%ziplink.net Exp $ + * $Id: PredicateList.cpp,v 1.2 2001-04-03 12:36:07 peterv%netscape.com Exp $ */ #include "Expr.h" @@ -30,7 +30,7 @@ * Represents an ordered list of Predicates, * for use with Step and Filter Expressions * @author Keith Visco - * @version $Revision: 1.1 $ $Date: 2000-04-06 07:45:37 $ + * @version $Revision: 1.2 $ $Date: 2001-04-03 12:36:07 $ **/ //-- PredicateList Implementation --/ @@ -100,6 +100,7 @@ void PredicateList::evaluatePredicates(NodeSet* nodes, ContextState* cs) { if (! exprResult->booleanValue() ) remNodes.add(node); break; } + delete exprResult; } } //-- remove unmatched nodes diff --git a/extensions/transformiix/source/xpath/RelationalExpr.cpp b/extensions/transformiix/source/xpath/RelationalExpr.cpp index a92dd0e5857..b8959e9631f 100644 --- a/extensions/transformiix/source/xpath/RelationalExpr.cpp +++ b/extensions/transformiix/source/xpath/RelationalExpr.cpp @@ -21,7 +21,7 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: RelationalExpr.cpp,v 1.4 2000-08-26 04:45:57 Peter.VanderBeken%pandora.be Exp $ + * $Id: RelationalExpr.cpp,v 1.5 2001-04-03 12:36:03 peterv%netscape.com Exp $ */ #include "Expr.h" @@ -165,7 +165,10 @@ ExprResult* RelationalExpr::evaluate(Node* context, ContextState* cs) { delete lResult; return new BooleanResult(); } - return new BooleanResult(compareResults(lResult, rResult)); + BooleanResult* boolResult = new BooleanResult(compareResults(lResult, rResult)); + delete lResult; + delete rResult; + return boolResult; } //-- evaluate /** diff --git a/extensions/transformiix/source/xpath/StringFunctionCall.cpp b/extensions/transformiix/source/xpath/StringFunctionCall.cpp index 3c472b81a47..e3ebbbd0920 100644 --- a/extensions/transformiix/source/xpath/StringFunctionCall.cpp +++ b/extensions/transformiix/source/xpath/StringFunctionCall.cpp @@ -21,14 +21,14 @@ * Keith Visco, kvisco@ziplink.net * -- original author. * - * $Id: StringFunctionCall.cpp,v 1.7 2001-01-22 20:23:47 axel%pike.org Exp $ + * $Id: StringFunctionCall.cpp,v 1.8 2001-04-03 12:35:57 peterv%netscape.com Exp $ */ /** * StringFunctionCall * A representation of the XPath String funtions * @author Keith Visco - * @version $Revision: 1.7 $ $Date: 2001-01-22 20:23:47 $ + * @version $Revision: 1.8 $ $Date: 2001-04-03 12:35:57 $ **/ #include "FunctionLib.h" @@ -260,9 +260,10 @@ ExprResult* StringFunctionCall::evaluate(Node* context, ContextState* cs) { else src.append(chars[i]); } delete chars; - return new StringResult(src); + result = new StringResult(src); } - result = new StringResult(""); + else + result = new StringResult(""); break; default : //-- string( object? )