]> git.unchartedbackwaters.co.uk Git - francis/stp.git/commitdiff
Fix a leak. I'd forgotten to call fclose().
authortrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Sat, 5 Mar 2011 03:21:07 +0000 (03:21 +0000)
committertrevor_hansen <trevor_hansen@e59a4935-1847-0410-ae03-e826735625c1>
Sat, 5 Mar 2011 03:21:07 +0000 (03:21 +0000)
git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@1188 e59a4935-1847-0410-ae03-e826735625c1

src/main/main.cpp

index 77f2b67b4fb3d196cb81c91d62202a9b6364fa10..b0cb1246496e9dd787cc1e1620a30e24c51a3093 100644 (file)
@@ -449,12 +449,15 @@ int main(int argc, char ** argv) {
          }
   }
 
+  FILE* toClose= 0;
+
   // If we're not reading the file from stdin.
   if (infile != NULL)
   {
   if (bm->UserFlags.smtlib1_parser_flag)
     {
       smtin = fopen(infile,"r");
+      toClose = smtin;
       if(smtin == NULL)
         {
           fprintf(stderr,"%s: Error: cannot open %s\n",prog,infile);
@@ -464,6 +467,7 @@ int main(int argc, char ** argv) {
         if (bm->UserFlags.smtlib2_parser_flag)
           {
             smt2in = fopen(infile,"r");
+            toClose = smt2in;
             if(smt2in == NULL)
               {
                 fprintf(stderr,"%s: Error: cannot open %s\n",prog,infile);
@@ -474,6 +478,7 @@ int main(int argc, char ** argv) {
   else
     {
       cvcin = fopen(infile,"r");
+      toClose = cvcin;
       if(cvcin == NULL)
         {
           fprintf(stderr,"%s: Error: cannot open %s\n",prog,infile);
@@ -521,6 +526,8 @@ int main(int argc, char ** argv) {
                        cvclex_destroy();
                }
                parserInterface = NULL;
+               if (toClose != NULL)
+                       fclose(toClose);
        }
        bm->GetRunTimes()->stop(RunTimes::Parsing);