Revision: 1238
http://www.exim.org/viewvc/pcre2?view=rev&revision=1238
Author: ph10
Date: 2020-03-24 17:25:58 +0000 (Tue, 24 Mar 2020)
Log Message:
-----------
Fix resource leak in pcre2test introduced by recent patch.
Modified Paths:
--------------
code/trunk/src/pcre2test.c
Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c 2020-03-20 18:09:59 UTC (rev 1237)
+++ code/trunk/src/pcre2test.c 2020-03-24 17:25:58 UTC (rev 1238)
@@ -5083,18 +5083,19 @@
{
(void)PCRE2_CONFIG(PCRE2_CONFIG_TABLES_LENGTH, &loadtables_length);
tables3 = malloc(loadtables_length);
- if (tables3 == NULL)
- {
- fprintf(outfile, "** Failed: malloc failed for #loadtables\n");
- return PR_ABEND;
- }
}
- if (fread(tables3, 1, loadtables_length, f) != loadtables_length)
+ if (tables3 == NULL)
{
+ fprintf(outfile, "** Failed: malloc failed for #loadtables\n");
+ yield = PR_ABEND;
+ }
+ else if (fread(tables3, 1, loadtables_length, f) != loadtables_length)
+ {
fprintf(outfile, "** Wrong return from fread()\n");
yield = PR_ABEND;
}
+
fclose(f);
break;
}