Fix some leaks (bug #72179). Not part of default build. r=Pike.

This commit is contained in:
peterv%netscape.com 2001-04-03 12:36:07 +00:00
Родитель a5a745433a
Коммит fd1c025485
4 изменённых файлов: 30 добавлений и 16 удалений

Просмотреть файл

@ -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 <a href="kvisco@ziplink.net">Keith Visco</a>
* @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

Просмотреть файл

@ -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 <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @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

Просмотреть файл

@ -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
/**

Просмотреть файл

@ -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 <A HREF="mailto:kvisco@ziplink.net">Keith Visco</A>
* @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? )