Bug 1292869 - Fix null deref in imgRequestProxy::GetImagePrincipal. r=jmuizelaar a=lizzard
authorChristoph Kerschbaumer <ckerschb@christophkerschbaumer.com>
Wed, 10 Aug 2016 10:12:30 +0200
changeset 349713 e2249d2604d43b6b37cc93aee93138ae4fb06bf9
parent 349712 1d6e23c55af3319d778b314286275a1916ef4303
child 349714 5783870130eeb0bea2280c84a15b0e2494edcfea
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmuizelaar, lizzard
bugs1292869
milestone50.0a2
Bug 1292869 - Fix null deref in imgRequestProxy::GetImagePrincipal. r=jmuizelaar a=lizzard
image/imgRequestProxy.cpp
--- a/image/imgRequestProxy.cpp
+++ b/image/imgRequestProxy.cpp
@@ -663,17 +663,18 @@ imgRequestProxy::PerformClone(imgINotifi
 
 NS_IMETHODIMP
 imgRequestProxy::GetImagePrincipal(nsIPrincipal** aPrincipal)
 {
   if (!GetOwner()) {
     return NS_ERROR_FAILURE;
   }
 
-  NS_ADDREF(*aPrincipal = GetOwner()->GetPrincipal());
+  nsCOMPtr<nsIPrincipal> principal = GetOwner()->GetPrincipal();
+  principal.forget(aPrincipal);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 imgRequestProxy::GetMultipart(bool* aMultipart)
 {
   if (!GetOwner()) {
     return NS_ERROR_FAILURE;