From 513d4f39117025943cf0129c80244089aba0026a Mon Sep 17 00:00:00 2001 From: trevor_hansen Date: Sat, 5 Mar 2011 03:21:07 +0000 Subject: [PATCH] Fix a leak. I'd forgotten to call fclose(). 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/main.cpp b/src/main/main.cpp index 77f2b67..b0cb124 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -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); -- 2.47.3