Issue #2083 - Part 5: Fix memory leak in RegExpObject.

Based on Mozilla bug 1345177.
This commit is contained in:
Job Bautista 2023-01-25 19:41:09 +08:00 committed by roytam1
commit b7e4530861
2 changed files with 2 additions and 1 deletions

View file

@ -975,6 +975,8 @@ RegExpShared::discardJitCode()
void
RegExpShared::finalize(FreeOp* fop)
{
for (auto& comp : compilationArray)
js_free(comp.byteCode);
for (size_t i = 0; i < tables.length(); i++)
js_free(tables[i]);
tables.~JitCodeTables();

View file

@ -121,7 +121,6 @@ class RegExpShared : public gc::TenuredCell
uint8_t* byteCode;
RegExpCompilation() : byteCode(nullptr) {}
~RegExpCompilation() { js_free(byteCode); }
bool compiled(ForceByteCodeEnum force = DontForceByteCode) const {
return byteCode || (force == DontForceByteCode && jitCode);