blob: 8b1c2421a424328e130c92f23b68e49925b7ae05 [file] [log] [blame]
/google/src/cloud/gfalcon/hunspell_copybara//patches/05.leakfix.patch - empty, assuming text.
Change 501585639 by mghiware@mghiware:fuzzer-5701496409030656:5968:citc on 2023/01/12 09:24:36
Release memory allocated during parsing on early returns due to errors
PRESUBMIT=passed
BUG=259670020
FIXED=259670020
R=bkuang
CC=jiho
REQUIRED_REVIEW=1
DELTA=7 (7 added, 0 deleted, 0 changed)
DELTA_BY_EXTENSION=cxx=7
OCL=501403365
Affected files ...
... //depot//src/hunspell/affixmgr.cxx#8 edit
==== //depot//src/hunspell/affixmgr.cxx#7 - /google/src/files/501585639/depot//src/hunspell/affixmgr.cxx ====
--- /google/src/files/501584981/depot//src/hunspell/affixmgr.cxx 2023-01-12 12:22:06.000000000 -0500
+++ /google/src/files/501585639/depot//src/hunspell/affixmgr.cxx 2023-01-12 12:24:36.000000000 -0500
@@ -3644,6 +3644,13 @@
}
if ((!(reptable[j].pattern)) || (!(reptable[j].pattern2))) {
HUNSPELL_WARNING(stderr, "error: line %d: table is corrupt\n", af->getlinenum());
+ // Free up memory allocated during parsing
+ for (int k=0; k < j; k++) {
+ free(reptable[k].pattern);
+ free(reptable[k].pattern2);
+ }
+ if (reptable[j].pattern) free(reptable[j].pattern);
+ if (reptable[j].pattern2) free(reptable[j].pattern2);
numrep = 0;
return 1;
}