Skip to content

Commit

Permalink
Fixed a missing fclose
Browse files Browse the repository at this point in the history
(to be backported as a fix)
  • Loading branch information
GiovanniBussi committed Mar 9, 2023
1 parent f5110df commit edb0587
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/mapping/PathTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,11 @@ int PathTools::main(FILE* in, FILE*out,Communicator& pc) {
std::string ofmt; parse("--arg-fmt",ofmt);
std::string ofilename; parse("--out",ofilename);
if( ifilename.length()>0 ) {
fprintf(out,"Reparameterising path in file named %s so that all frames are equally spaced \n",ifilename.c_str() );
FILE* fp=fopen(ifilename.c_str(),"r");
std::fprintf(out,"Reparameterising path in file named %s so that all frames are equally spaced \n",ifilename.c_str() );
FILE* fp=std::fopen(ifilename.c_str(),"r");
// call fclose when fp goes out of scope
auto deleter=[](FILE* f) { if(f) std::fclose(f); };
std::unique_ptr<FILE,decltype(deleter)> fp_deleter(fp,deleter);
bool do_read=true; std::vector<std::unique_ptr<ReferenceConfiguration>> frames;
while (do_read) {
PDB mypdb;
Expand Down

1 comment on commit edb0587

@PlumedBot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found broken examples in automatic/performance-optimization.txt
Found broken examples in automatic/a-trieste-6.txt
Found broken examples in automatic/munster.txt
Found broken examples in automatic/ANN.tmp
Found broken examples in automatic/EDS.tmp
Found broken examples in automatic/EMMI.tmp
Found broken examples in automatic/FOURIER_TRANSFORM.tmp
Found broken examples in automatic/FUNCPATHGENERAL.tmp
Found broken examples in automatic/FUNCPATHMSD.tmp
Found broken examples in automatic/FUNNEL.tmp
Found broken examples in automatic/FUNNEL_PS.tmp
Found broken examples in automatic/INCLUDE.tmp
Found broken examples in automatic/MAZE_MEMETIC_SAMPLING.tmp
Found broken examples in automatic/MAZE_OPTIMIZER_BIAS.tmp
Found broken examples in automatic/MAZE_RANDOM_ACCELERATION_MD.tmp
Found broken examples in automatic/MAZE_RANDOM_WALK.tmp
Found broken examples in automatic/MAZE_SIMULATED_ANNEALING.tmp
Found broken examples in automatic/MAZE_STEERED_MD.tmp
Found broken examples in automatic/PIV.tmp
Found broken examples in automatic/PLUMED.tmp
Found broken examples in MiscelaneousPP.md

Please sign in to comment.