Bug 1281408 - Nullcheck `mInputPort` in MediaStreamAudioSourceNode to prevent crashing when getting memory reports after the underlying MediaStream has been destroyed. r=pehrsons
authorPaul Adenot <paul@paul.cx>
Wed, 22 Jun 2016 18:20:46 +0200
changeset 381508 f35504e8fc9de135eb1a697828dcec202d082ffb
parent 381507 51d28e336d478a2b35bae1668cce76594f732665
child 381509 984b53d372f7098a71aaa032ce6e3f0e2b371f0c
push id21504
push userbmo:npang@mozilla.com
push dateMon, 27 Jun 2016 18:10:09 +0000
reviewerspehrsons
bugs1281408
milestone50.0a1
Bug 1281408 - Nullcheck `mInputPort` in MediaStreamAudioSourceNode to prevent crashing when getting memory reports after the underlying MediaStream has been destroyed. r=pehrsons MozReview-Commit-ID: 7OzFPmLVJA5
dom/media/webaudio/MediaStreamAudioSourceNode.cpp
--- a/dom/media/webaudio/MediaStreamAudioSourceNode.cpp
+++ b/dom/media/webaudio/MediaStreamAudioSourceNode.cpp
@@ -193,17 +193,19 @@ MediaStreamAudioSourceNode::PrincipalCha
 }
 
 size_t
 MediaStreamAudioSourceNode::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
 {
   // Future:
   // - mInputStream
   size_t amount = AudioNode::SizeOfExcludingThis(aMallocSizeOf);
-  amount += mInputPort->SizeOfIncludingThis(aMallocSizeOf);
+  if (mInputPort) {
+    amount += mInputPort->SizeOfIncludingThis(aMallocSizeOf);
+  }
   return amount;
 }
 
 size_t
 MediaStreamAudioSourceNode::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }