Revision: 692
http://www.exim.org/viewvc/pcre2?view=rev&revision=692
Author: ph10
Date: 2017-03-21 16:18:54 +0000 (Tue, 21 Mar 2017)
Log Message:
-----------
Close serialization file in pcre2test after any error.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/src/pcre2test.c
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2017-03-21 16:09:57 UTC (rev 691)
+++ code/trunk/ChangeLog 2017-03-21 16:18:54 UTC (rev 692)
@@ -68,7 +68,10 @@
of the section that is compiled when Unix-style directory scanning is
available, and into a new section that is always compiled for Windows.
+10. In pcre2test, explicitly close the file after an error during serialization
+or deserialization (the "load" or "save" commands).
+
Version 10.23 14-February-2017
------------------------------
Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c 2017-03-21 16:09:57 UTC (rev 691)
+++ code/trunk/src/pcre2test.c 2017-03-21 16:18:54 UTC (rev 692)
@@ -4456,6 +4456,7 @@
if (rc < 0)
{
serial_error(rc, "Serialization");
+ fclose(f);
break;
}
@@ -4469,6 +4470,7 @@
if (fwrite(serial, 1, serial_size, f) != serial_size)
{
fprintf(outfile, "** Wrong return from fwrite()\n");
+ fclose(f);
return PR_ABEND;
}
@@ -4496,6 +4498,7 @@
{
fprintf(outfile, "** Failed to get memory (size %lu) for #load\n",
(unsigned long int)serial_size);
+ fclose(f);
return PR_ABEND;
}
@@ -4503,6 +4506,7 @@
{
fprintf(outfile, "** Wrong return from fread()\n");
free(serial);
+ fclose(f);
return PR_ABEND;
}
fclose(f);