Fix memory leaks
authorbdemsky <bdemsky@uci.edu>
Sat, 26 Aug 2017 00:18:32 +0000 (17:18 -0700)
committerbdemsky <bdemsky@uci.edu>
Sat, 26 Aug 2017 00:18:32 +0000 (17:18 -0700)
src/AST/boolean.h
src/AST/element.h
src/AST/predicate.h
src/csolver.cc

index d958dc0..4bab811 100644 (file)
@@ -20,6 +20,7 @@
 class Boolean : public ASTNode {
  public:
        Boolean(ASTNodeType _type);
+       virtual ~Boolean() {}
        Polarity polarity;
        BooleanValue boolVal;
        Vector<Boolean *> parents;
index fe5f42b..6a8ea95 100644 (file)
@@ -13,7 +13,7 @@
 class Element : public ASTNode {
  public:
        Element(ASTNodeType type);
-       ~Element();
+       virtual ~Element();
        Vector<ASTNode *> parents;
        ElementEncoding encoding;
        MEMALLOC;
index c59a6a6..96f462d 100644 (file)
@@ -10,6 +10,7 @@
 class Predicate {
  public:
   Predicate(PredicateType _type) : type(_type) {}
+       virtual ~Predicate() {}
        PredicateType type;
        MEMALLOC;
 };
index cdbb919..64f0851 100644 (file)
@@ -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;
 }