diff options
author | ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069> | 2020-03-24 17:25:58 +0000 |
---|---|---|
committer | ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069> | 2020-03-24 17:25:58 +0000 |
commit | 36550126dbf52a4169580d53b773418554eb3d1d (patch) | |
tree | dda4f386e2beff7c79cceeffaed90d81de55a369 | |
parent | 2ec85e0009fc1808ed79b4697e8502795b46564b (diff) | |
download | pcre2-36550126dbf52a4169580d53b773418554eb3d1d.tar.gz |
Fix resource leak in pcre2test introduced by recent patch.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1238 6239d852-aaf2-0410-a92c-79f79f948069
-rw-r--r-- | src/pcre2test.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/pcre2test.c b/src/pcre2test.c index 4657449..ed75e06 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -5083,18 +5083,19 @@ switch(cmd) { (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; } |