From 7e84a5e76ba83b5f73760589efb051970d58172f Mon Sep 17 00:00:00 2001 From: Tim King Date: Fri, 11 Nov 2016 16:04:51 -0800 Subject: [PATCH] Deleting the remaining commands in the Parser's queue within ~Parser(). --- src/parser/parser.cpp | 10 ++++++++++ src/parser/parser.h | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/parser/parser.cpp b/src/parser/parser.cpp index ac93c93d2..2377b8a44 100644 --- a/src/parser/parser.cpp +++ b/src/parser/parser.cpp @@ -61,6 +61,16 @@ Parser::Parser(ExprManager* exprManager, Input* input, bool strictMode, d_input->setParser(*this); } +Parser::~Parser() { + for (std::list::iterator iter = d_commandQueue.begin(); + iter != d_commandQueue.end(); ++iter) { + Command* command = *iter; + delete command; + } + d_commandQueue.clear(); + delete d_input; +} + Expr Parser::getSymbol(const std::string& name, SymbolType type) { checkDeclaration(name, CHECK_DECLARED, type); assert(isDeclared(name, type)); diff --git a/src/parser/parser.h b/src/parser/parser.h index 351aa858a..b310456bd 100644 --- a/src/parser/parser.h +++ b/src/parser/parser.h @@ -230,6 +230,8 @@ class CVC4_PUBLIC Parser { * "Preemption commands": extra commands implied by subterms that * should be issued before the currently-being-parsed command is * issued. Used to support SMT-LIBv2 ":named" attribute on terms. + * + * Owns the memory of the Commands in the queue. */ std::list d_commandQueue; @@ -254,9 +256,7 @@ protected: public: - virtual ~Parser() { - delete d_input; - } + virtual ~Parser(); /** Get the associated ExprManager. */ inline ExprManager* getExprManager() const { -- 2.30.2