Commit 6af511da authored by Guillaume Baulieu's avatar Guillaume Baulieu
Browse files

Freeing leaking memory and closing opened file

parent 8eee1579
......@@ -350,6 +350,7 @@ bool adetParams::ReadXtalkCoeffs(std::string cname, bool verbose)
while(fscanf(tfp, "%d %d %f", &segseen, &seggate, &xx) == 3) {
if(seggate < 0 || seggate >= kNSG || segseen < 0 || segseen >= kNSG) {
printf("\nWrong channel number: %d %d %f\n", seggate, segseen, xx);
fclose(tfp);
return false;
}
xTalkProp[segseen][seggate] = xx;
......
......@@ -107,11 +107,13 @@ Int_t AncillaryFilterVME::AlgoInitialise()
for(int ii = 0; ii< 3*32; ii++) {
if(fscanf(conf_file,"%d %d %d",&Conv,&Ch,&Cont) != 3) {
cout << "Error reading line " << ii << " of " << fPRISMALUTFile << endl;
fclose(conf_file);
return 132;
}
LUT[Conv][Ch]= Cont;
cout << "LUT[ " << Conv << " ][ " << setw(2) << Ch << " ] = " << setw(3) << LUT[Conv][Ch] << endl;
}
fclose(conf_file);
#endif // ANF_PRISMA
return 0;
......
......@@ -2299,6 +2299,8 @@ void openFileMGTDIR(const char * name, FILE **fp)
printf("\nError opening %s\n", filename);
errexit("openFileMGTDIR");
}
free(filename);
free(workdir);
}
#if STATINSIDEDET == 1
......
......@@ -197,6 +197,7 @@ int main ( int argc, char *argv[] ) {
} else {
// error opening file
printf ( "Could not read file... reached EOF?\n");
fclose(fp);
return 0;
}
......@@ -242,5 +243,6 @@ int main ( int argc, char *argv[] ) {
}
*/
} //while (keep_connection_alive)
fclose(fp);
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment