Deleting a temporary in theory sets enumerator.
authorTim King <taking@google.com>
Mon, 26 Sep 2016 01:20:52 +0000 (18:20 -0700)
committerTim King <taking@google.com>
Mon, 26 Sep 2016 01:20:52 +0000 (18:20 -0700)
src/theory/sets/theory_sets_type_enumerator.h

index 40863b0f2403da168494fa504d8f206ede061ee6..f2d6bae6893cf8b25755bbb2615a874b5070acff 100644 (file)
@@ -153,14 +153,16 @@ public:
     }
 
     while (d_constituentVec.size() < d_index) {
-      TypeEnumerator *d_newEnumerator = new TypeEnumerator(*d_constituentVec.back());
-      ++(*d_newEnumerator);
-      if( (*d_newEnumerator).isFinished() ) {
+      TypeEnumerator* newEnumerator =
+          new TypeEnumerator(*d_constituentVec.back());
+      ++(*newEnumerator);
+      if (newEnumerator->isFinished()) {
         Trace("set-type-enum") << "operator++ finished!" << std::endl;
+        delete newEnumerator;
         d_finished = true;
         return *this;
       }
-      d_constituentVec.push_back(d_newEnumerator);
+      d_constituentVec.push_back(newEnumerator);
     }
 
     Trace("set-type-enum") << "operator++ returning, **this = " << **this << std::endl;