Bug 1275129 - Add missing null check in OrphanReporter::sizeOfIncludingThis. r=mccr8, a=ritu
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 24 May 2016 10:27:02 +1000
changeset 333080 2178fddc69247d8371c234030fade3c5149e9754
parent 333079 65badb6bff1ea4b79837500e1a8b5969ea7fe489
child 333081 3cab4d427bfab94df5927f8354af449b850c6a57
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8, ritu
bugs1275129
milestone48.0a2
Bug 1275129 - Add missing null check in OrphanReporter::sizeOfIncludingThis. r=mccr8, a=ritu
js/xpconnect/src/XPCJSRuntime.cpp
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -2746,17 +2746,18 @@ class OrphanReporter : public JS::Object
         // assumptions.  Yuk.
         if (node && !node->IsInUncomposedDoc() &&
             !(node->IsElement() && node->AsElement()->IsInNamespace(kNameSpaceID_XBL)))
         {
             // This is an orphan node.  If we haven't already handled the
             // sub-tree that this node belongs to, measure the sub-tree's size
             // and then record its root so we don't measure it again.
             nsCOMPtr<nsINode> orphanTree = node->SubtreeRoot();
-            if (!mAlreadyMeasuredOrphanTrees.Contains(orphanTree)) {
+            if (orphanTree &&
+                !mAlreadyMeasuredOrphanTrees.Contains(orphanTree)) {
                 // If PutEntry() fails we don't measure this tree, which could
                 // lead to under-measurement. But that's better than the
                 // alternatives, which are over-measurement or an OOM abort.
                 if (mAlreadyMeasuredOrphanTrees.PutEntry(orphanTree, fallible)) {
                     n += SizeOfTreeIncludingThis(orphanTree);
                 }
             }
         }