Skip to content

Commit

Permalink
Fixes suggested by "cppcheck" static code analysis tool
Browse files Browse the repository at this point in the history
  • Loading branch information
willend committed Feb 24, 2024
1 parent 02916f5 commit c733cca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion mcstas-comps/samples/PowderN.comp
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,10 @@ struct line_info_struct
ret = system(cmd);
}

if (ret == -1 || ret == 127) return(NULL);
if (ret == -1 || ret == 127) {
free(OUTFILE);
return(NULL);
}

// test if the result file has been created
FILE *file = fopen(OUTFILE,"r");
Expand All @@ -343,6 +346,7 @@ struct line_info_struct
printf ("%s\n",cmd);
);
fflush(NULL);
fclose(file);
return(OUTFILE);
} // cif2hkl
#endif
Expand Down
6 changes: 5 additions & 1 deletion mcstas-comps/samples/Single_crystal.comp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,10 @@ double tau; /* Length of (tau_x, tau_y, tau_z) */
ret = system(cmd);
}

if (ret == -1 || ret == 127) return(NULL);
if (ret == -1 || ret == 127) {
free(OUTFILE);
return(NULL);
}

// test if the result file has been created
FILE *file = fopen(OUTFILE,"r");
Expand All @@ -448,6 +451,7 @@ double tau; /* Length of (tau_x, tau_y, tau_z) */
printf ("%s\n",cmd);
);
fflush(NULL);
fclose(file);
return(OUTFILE);
} // cif2hkl
#endif
Expand Down

0 comments on commit c733cca

Please sign in to comment.