File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -304,13 +304,25 @@ struct line_info_struct
304304 && strcasecmp(ext, "res")) return infile;
305305
306306 OUTFILE = malloc(1024);
307- if (!OUTFILE) return infile;
307+ if (!OUTFILE) {
308+ free(OUTFILE);
309+ return infile;
310+ }
308311 inpath = malloc(1024);
309- if (!inpath) return infile;
312+ if (!inpath) {
313+ free(OUTFILE);
314+ free(inpath);
315+ return infile;
316+ }
310317
311318 // get input file path from read-table:Open_File
312319 FILE *f_infile = Open_File(infile, "r", inpath);
313- if (!f_infile) return infile;
320+ if (!f_infile) {
321+ free(OUTFILE);
322+ free(inpath);
323+ free(f_infile);
324+ return infile;
325+ }
314326 fclose(f_infile);
315327
316328 strncpy(OUTFILE, tmpnam(NULL), 1024); // create an output temporary file name
Original file line number Diff line number Diff line change @@ -413,13 +413,25 @@ struct hkl_data
413413 && strcasecmp(ext, "res")) return infile;
414414
415415 OUTFILE = malloc(1024);
416- if (!OUTFILE) return infile;
416+ if (!OUTFILE) {
417+ free(OUTFILE);
418+ return infile;
419+ }
417420 inpath = malloc(1024);
418- if (!inpath) return infile;
421+ if (!inpath) {
422+ free(OUTFILE);
423+ free(inpath);
424+ return infile;
425+ }
419426
420427 // get input file path from read-table:Open_File
421428 FILE *f_infile = Open_File(infile, "r", inpath);
422- if (!f_infile) return infile;
429+ if (!f_infile) {
430+ free(OUTFILE);
431+ free(inpath);
432+ free(f_infile);
433+ return infile;
434+ }
423435 fclose(f_infile);
424436
425437 strncpy(OUTFILE, tmpnam(NULL), 1024); // create an output temporary file name
You can’t perform that action at this time.
0 commit comments