From 9f703a622069cbfa76ef2e2efb393ab1714c0342 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Fri, 25 Aug 2017 17:18:32 -0700 Subject: [PATCH] Fix memory leaks --- src/AST/boolean.h | 1 + src/AST/element.h | 2 +- src/AST/predicate.h | 1 + src/csolver.cc | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/AST/boolean.h b/src/AST/boolean.h index d958dc0..4bab811 100644 --- a/src/AST/boolean.h +++ b/src/AST/boolean.h @@ -20,6 +20,7 @@ class Boolean : public ASTNode { public: Boolean(ASTNodeType _type); + virtual ~Boolean() {} Polarity polarity; BooleanValue boolVal; Vector parents; diff --git a/src/AST/element.h b/src/AST/element.h index fe5f42b..6a8ea95 100644 --- a/src/AST/element.h +++ b/src/AST/element.h @@ -13,7 +13,7 @@ class Element : public ASTNode { public: Element(ASTNodeType type); - ~Element(); + virtual ~Element(); Vector parents; ElementEncoding encoding; MEMALLOC; diff --git a/src/AST/predicate.h b/src/AST/predicate.h index c59a6a6..96f462d 100644 --- a/src/AST/predicate.h +++ b/src/AST/predicate.h @@ -10,6 +10,7 @@ class Predicate { public: Predicate(PredicateType _type) : type(_type) {} + virtual ~Predicate() {} PredicateType type; MEMALLOC; }; diff --git a/src/csolver.cc b/src/csolver.cc index cdbb919..64f0851 100644 --- a/src/csolver.cc +++ b/src/csolver.cc @@ -155,7 +155,7 @@ Boolean *CSolver::applyPredicate(Predicate *predicate, Element **inputs, uint nu } Boolean *CSolver::applyPredicateTable(Predicate *predicate, Element **inputs, uint numInputs, Boolean *undefinedStatus) { - Boolean *boolean = new BooleanPredicate(predicate, inputs, numInputs, undefinedStatus); + BooleanPredicate *boolean = new BooleanPredicate(predicate, inputs, numInputs, undefinedStatus); allBooleans.push(boolean); return boolean; } -- 2.34.1