]> git.unchartedbackwaters.co.uk Git - francis/stp.git/commitdiff
Fix small memory leak.
authortrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Sun, 9 Jan 2011 04:04:12 +0000 (04:04 +0000)
committertrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Sun, 9 Jan 2011 04:04:12 +0000 (04:04 +0000)
git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@1058 e59a4935-1847-0410-ae03-e826735625c1

src/simplifier/consteval.cpp

index 97684b767bcb23adbc5e286c0c66e67611bcfd94..f8c4d5e655e831ebab49a007dc930ade7eb1e5f5 100644 (file)
@@ -457,8 +457,6 @@ namespace BEEV
       case BVMOD:
         {
           assert(2==number_of_children);
-          CBV quotient = CONSTANTBV::BitVector_Create(inputwidth, true);
-          CBV remainder = CONSTANTBV::BitVector_Create(inputwidth, true);
 
           if (_bm->UserFlags.division_by_zero_returns_one_flag 
               && CONSTANTBV::BitVector_is_empty(tmp1))
@@ -474,6 +472,8 @@ namespace BEEV
             }
           else
             {
+              CBV quotient = CONSTANTBV::BitVector_Create(inputwidth, true);
+              CBV remainder = CONSTANTBV::BitVector_Create(inputwidth, true);
 
               // tmp0 is dividend, tmp1 is the divisor All parameters
               //to BitVector_Div_Pos must be distinct unlike
@@ -487,7 +487,9 @@ namespace BEEV
 
               if (0 != e)
                 {
-                  //error printing
+                 CONSTANTBV::BitVector_Destroy(quotient);
+                 CONSTANTBV::BitVector_Destroy(remainder);
+                 //error printing
                   if (_bm->counterexample_checking_during_refinement)
                     {
                       output = CONSTANTBV::BitVector_Create(inputwidth, true);