diff --git a/src/pst2dii.cpp.in b/src/pst2dii.cpp.in index 612e3ec..b9dac80 100644 --- a/src/pst2dii.cpp.in +++ b/src/pst2dii.cpp.in @@ -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)); } diff --git a/src/readpst.c b/src/readpst.c index 57b1b81..1cea894 100644 --- a/src/readpst.c +++ b/src/readpst.c @@ -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)); }