Fix possible memory leak in AstStorage ctor

Reviewers: teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1553
This commit is contained in:
Marin Tomic 2018-08-22 16:19:15 +02:00
parent 50c75c56a4
commit ce31ff4625

View File

@ -7,7 +7,10 @@
namespace query {
AstStorage::AstStorage() { storage_.emplace_back(new Query(next_uid_++)); }
AstStorage::AstStorage() {
std::unique_ptr<Query> root(new Query(next_uid_++));
storage_.emplace_back(std::move(root));
}
Query *AstStorage::query() const {
return dynamic_cast<Query *>(storage_[0].get());