diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp index a5bf4fe8b3..61baadef81 100644 --- a/js/src/vm/RegExpObject.cpp +++ b/js/src/vm/RegExpObject.cpp @@ -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(); diff --git a/js/src/vm/RegExpObject.h b/js/src/vm/RegExpObject.h index 289c4f0dc9..0056c6aee9 100644 --- a/js/src/vm/RegExpObject.h +++ b/js/src/vm/RegExpObject.h @@ -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);