Skip to content

Commit

Permalink
Fix potential file handle leakage
Browse files Browse the repository at this point in the history
  • Loading branch information
pabs3 committed Aug 20, 2023
1 parent b567571 commit b51ad19
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/pst2dii.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ static string write_separate_attachment(string fname, pst_item_attach* current_a
else
sprintf(temp, "%s/%s_%s-%i", output_directory, f_name, attach_filename, x);
} while ((fp = fopen(temp, "r")) && ++x < 99999999);
if (fp) fclose(fp);
if (x > 99999999) {
DIE(("error finding attachment name. exhausted possibilities to %s\n", temp));
}
Expand Down
1 change: 1 addition & 0 deletions src/readpst.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,7 @@ void write_separate_attachment(char f_name[], pst_item_attach* attach, int attac
else
sprintf(temp, "%s-%s-%i", f_name, attach_filename, x);
} while ((fp = fopen(temp, "r")) && ++x < 99999999);
if (fp) fclose(fp);
if (x > 99999999) {
DIE(("error finding attachment name. exhausted possibilities to %s\n", temp));
}
Expand Down

0 comments on commit b51ad19

Please sign in to comment.