mirror of https://gitee.com/bigwinds/arangodb
fixed memleaks
This commit is contained in:
parent
e05cd2df37
commit
9497ca9c7c
|
@ -320,28 +320,6 @@ int TraversalBlock::initializeCursor (AqlItemBlock* items,
|
|||
return ExecutionBlock::initializeCursor(items, pos);
|
||||
}
|
||||
|
||||
bool TraversalBlock::executeExpressions (AqlValue& pathValue) {
|
||||
return true;
|
||||
TRI_ASSERT(_condition != nullptr);
|
||||
|
||||
auto& toReplace = _nonConstExpressions[0];
|
||||
auto exp = toReplace->expression;
|
||||
|
||||
TRI_document_collection_t const* myCollection = nullptr;
|
||||
|
||||
AqlItemBlock b(1, 3);
|
||||
b.setValue(0, 2, pathValue);
|
||||
std::vector<Variable const*> outVars({_vertexVar, _edgeVar, _pathVar});
|
||||
AqlValue a = exp->execute(_trx, &b, 0, outVars, _inRegs[0], &myCollection);
|
||||
b.eraseValue(0, 2);
|
||||
|
||||
bool rc = a.isTrue();
|
||||
a.destroy();
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief read more paths
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -368,12 +346,6 @@ bool TraversalBlock::morePaths (size_t hint) {
|
|||
pathValue = AqlValue(p->pathToJson(_trx, _resolver));
|
||||
}
|
||||
|
||||
if ((en->condition() != nullptr) &&
|
||||
! executeExpressions(pathValue)) {
|
||||
_traverser->prune();
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( usesVertexOutput() ) {
|
||||
_vertices.emplace_back(p->lastVertexToJson(_trx, _resolver));
|
||||
}
|
||||
|
|
|
@ -240,12 +240,6 @@ namespace triagens {
|
|||
// --SECTION-- private functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief executes path expressions to filter dead ends early.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool executeExpressions (AqlValue &pathOutput);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief continue fetching of paths
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -415,11 +415,13 @@ void TraversalNode::storeSimpleExpression(bool isEdgeAccess,
|
|||
AstNode const* varAccess,
|
||||
AstNode const* compareTo) {
|
||||
auto it = _expressions.find(indexAccess);
|
||||
|
||||
if (it == _expressions.end()) {
|
||||
std::vector<triagens::arango::traverser::TraverserExpression* > sec;
|
||||
_expressions.emplace(indexAccess, sec);
|
||||
it = _expressions.find(indexAccess);
|
||||
}
|
||||
|
||||
std::unique_ptr<SimpleTraverserExpression> e(new SimpleTraverserExpression(isEdgeAccess,
|
||||
comparisonType,
|
||||
varAccess,
|
||||
|
|
|
@ -108,9 +108,14 @@ namespace triagens {
|
|||
TraversalNode (ExecutionPlan* plan,
|
||||
triagens::basics::Json const& base);
|
||||
|
||||
|
||||
~TraversalNode () {
|
||||
delete _condition;
|
||||
|
||||
for (auto& it : _expressions) {
|
||||
for (auto& it2 : it.second) {
|
||||
delete it2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -701,11 +701,27 @@ Json* SingleServerTraversalPath::pathToJson (Transaction* trx,
|
|||
std::unique_ptr<Json> path(new Json(Json::Object, 2));
|
||||
Json vertices(Json::Array);
|
||||
for (size_t i = 0; i < _path.vertices.size(); ++i) {
|
||||
vertices(*vertexToJson(trx, resolver, _path.vertices[i]));
|
||||
auto v = vertexToJson(trx, resolver, _path.vertices[i]);
|
||||
try {
|
||||
vertices(*v);
|
||||
delete v;
|
||||
}
|
||||
catch (...) {
|
||||
delete v;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
Json edges(Json::Array);
|
||||
for (size_t i = 0; i < _path.edges.size(); ++i) {
|
||||
edges(*edgeToJson(trx, resolver, _path.edges[i]));
|
||||
auto e = edgeToJson(trx, resolver, _path.edges[i]);
|
||||
try {
|
||||
edges(*e);
|
||||
delete e;
|
||||
}
|
||||
catch (...) {
|
||||
delete e;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
(*path)("vertices", vertices)
|
||||
("edges", edges);
|
||||
|
|
Loading…
Reference in New Issue