1
0
Fork 0

Fixed bad access bugs from last commit.

This commit is contained in:
Michael Hackstein 2016-07-28 17:33:13 +02:00
parent 64d7f690da
commit b388fc3e87
3 changed files with 9 additions and 7 deletions

View File

@ -444,9 +444,10 @@ QueryResult Query::prepare(QueryRegistry* registry) {
_isModificationQuery = parser->isModificationQuery();
// create the transaction object, but do not start it yet
auto trx = std::make_unique<arangodb::AqlTransaction>(
arangodb::AqlTransaction* trx = new arangodb::AqlTransaction(
createTransactionContext(), _collections.collections(),
_part == PART_MAIN);
_trx = trx;
bool planRegisters;
@ -455,7 +456,6 @@ QueryResult Query::prepare(QueryRegistry* registry) {
int res = trx->begin();
if (res != TRI_ERROR_NO_ERROR) {
_trx = trx.release(); // Probably not needed here
return transactionError(res);
}
@ -469,7 +469,6 @@ QueryResult Query::prepare(QueryRegistry* registry) {
if (plan.get() == nullptr) {
// oops
_trx = trx.release(); // Probably not needed here
return QueryResult(TRI_ERROR_INTERNAL,
"failed to create query execution engine");
}
@ -501,7 +500,6 @@ QueryResult Query::prepare(QueryRegistry* registry) {
}
if (res != TRI_ERROR_NO_ERROR) {
_trx = trx.release(); // Probably not needed here
return transactionError(res);
}
@ -509,7 +507,6 @@ QueryResult Query::prepare(QueryRegistry* registry) {
plan.reset(ExecutionPlan::instantiateFromVelocyPack(parser->ast(), _queryBuilder->slice()));
if (plan.get() == nullptr) {
// oops
_trx = trx.release(); // Probably not needed here
return QueryResult(TRI_ERROR_INTERNAL);
}
@ -533,7 +530,6 @@ QueryResult Query::prepare(QueryRegistry* registry) {
_plan = plan.release();
_parser = parser.release();
_engine = engine;
_trx = trx.release();
return QueryResult();
} catch (arangodb::basics::Exception const& ex) {
cleanupPlanAndEngine(ex.code());

View File

@ -74,6 +74,12 @@ void arangodb::traverser::ShortestPath::vertexToVelocyPack(Transaction* trx, siz
}
}
arangodb::traverser::TraverserOptions::LookupInfo::LookupInfo()
: expression(nullptr), indexCondition(nullptr) {
// NOTE: We need exactly one in this case for the optimizer to update
idxHandles.resize(1);
};
arangodb::traverser::TraverserOptions::LookupInfo::~LookupInfo() {
if (expression != nullptr) {
delete expression;

View File

@ -234,7 +234,7 @@ struct TraverserOptions {
aql::Expression* expression;
aql::AstNode* indexCondition;
LookupInfo() : expression(nullptr), indexCondition(nullptr){};
LookupInfo();
~LookupInfo();
LookupInfo(LookupInfo const&);