Bug 795892 - Fix CORS listener refcnt in ChannelMediaResource::OpenChannel. r=roc
authorMatthew Gregan <kinetik@flim.org>
Tue, 02 Oct 2012 18:03:24 +1300
changeset 109016 9a73d985e5e93d00336afd4023696ff063eecf12
parent 109015 16ae4d5d27d702df5c95c7278ad1b7e4b9235e86
child 109017 9fec17552df2b1b12b506e464768e2d3026e1cec
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersroc
bugs795892
milestone18.0a1
Bug 795892 - Fix CORS listener refcnt in ChannelMediaResource::OpenChannel. r=roc
content/media/MediaResource.cpp
--- a/content/media/MediaResource.cpp
+++ b/content/media/MediaResource.cpp
@@ -597,17 +597,17 @@ nsresult ChannelMediaResource::OpenChann
 
     nsCOMPtr<nsIStreamListener> listener = mListener.get();
 
     // Ensure that if we're loading cross domain, that the server is sending
     // an authorizing Access-Control header.
     nsHTMLMediaElement* element = mDecoder->GetMediaElement();
     NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
     if (element->ShouldCheckAllowOrigin()) {
-      nsCORSListenerProxy* crossSiteListener =
+      nsRefPtr<nsCORSListenerProxy> crossSiteListener =
         new nsCORSListenerProxy(mListener,
                                 element->NodePrincipal(),
                                 false);
       nsresult rv = crossSiteListener->Init(mChannel);
       listener = crossSiteListener;
       NS_ENSURE_TRUE(crossSiteListener, NS_ERROR_OUT_OF_MEMORY);
       NS_ENSURE_SUCCESS(rv, rv);
     } else {