Bug 1478679 - Fix memory leak in LCovCompartment. r=nbp, a=IanN CLOSED TREE DONTBUILD SEAMONKEY_2_49_ESR_RELBRANCH
authorPhilip Chimento <philip.chimento@gmail.com>
Mon, 06 Aug 2018 18:01:57 -0400
branchSEAMONKEY_2_49_ESR_RELBRANCH
changeset 357527 d8da9e2109fc3bf4e312dce3c4901ec34176d007
parent 357526 b8f3bfa08918b8ad605696f81e359b2f183ae443
child 357528 c857231c34dffa83b0c5f84aa25d693af1c21f1f
push id7834
push userfrgrahl@gmx.net
push dateSun, 13 Jan 2019 12:17:02 +0000
treeherdermozilla-esr52@6e4ad8a8f2e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp, IanN
bugs1478679
milestone52.9.1
Bug 1478679 - Fix memory leak in LCovCompartment. r=nbp, a=IanN CLOSED TREE DONTBUILD mozilla-esr52 SEAMONKEY_2_49_ESR_RELBRANCH
js/src/vm/CodeCoverage.cpp
js/src/vm/CodeCoverage.h
--- a/js/src/vm/CodeCoverage.cpp
+++ b/js/src/vm/CodeCoverage.cpp
@@ -397,16 +397,22 @@ LCovSource::writeScript(JSScript* script
 LCovCompartment::LCovCompartment()
   : alloc_(4096),
     outTN_(&alloc_),
     sources_(nullptr)
 {
     MOZ_ASSERT(alloc_.isEmpty());
 }
 
+LCovCompartment::~LCovCompartment()
+{
+    if (sources_)
+        sources_->~LCovSourceVector();
+}
+
 void
 LCovCompartment::collectCodeCoverageInfo(JSCompartment* comp, JSObject* sso,
                                          JSScript* script)
 {
     // Skip any operation if we already some out-of memory issues.
     if (outTN_.hadOutOfMemory())
         return;
 
--- a/js/src/vm/CodeCoverage.h
+++ b/js/src/vm/CodeCoverage.h
@@ -83,16 +83,17 @@ class LCovSource
     bool hasFilename_ : 1;
     bool hasTopLevelScript_ : 1;
 };
 
 class LCovCompartment
 {
   public:
     LCovCompartment();
+    ~LCovCompartment();
 
     // Collect code coverage information for the given source.
     void collectCodeCoverageInfo(JSCompartment* comp, JSObject* sso, JSScript* topLevel);
 
     // Create an ebtry for the current ScriptSourceObject.
     void collectSourceFile(JSCompartment* comp, ScriptSourceObject* sso);
 
     // Write the Lcov output in a buffer, such as the one associated with