From 0eed7a8344af16486b08fe3ead7b003e7cfe086e Mon Sep 17 00:00:00 2001 From: Max Neunhoeffer Date: Mon, 8 Sep 2014 14:42:21 +0200 Subject: [PATCH] Handle exception correctly in AqlValue. --- arangod/Aql/AqlValue.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arangod/Aql/AqlValue.cpp b/arangod/Aql/AqlValue.cpp index efa9cb2576..4d7bdece5b 100644 --- a/arangod/Aql/AqlValue.cpp +++ b/arangod/Aql/AqlValue.cpp @@ -116,8 +116,17 @@ AqlValue AqlValue::clone () const { case DOCVEC: { auto c = new std::vector; c->reserve(_vector->size()); - for (auto it = _vector->begin(); it != _vector->end(); ++it) { - c->push_back((*it)->slice(0, (*it)->size())); + try { + for (auto it = _vector->begin(); it != _vector->end(); ++it) { + c->push_back((*it)->slice(0, (*it)->size())); + } + } + catch (...) { + for (auto x : *c) { + delete x; + } + delete c; + throw; } return AqlValue(c); }