bug 366559 - patch 5, fix nsHTTPCompressConv manual addref r=bagder
authorPatrick McManus <mcmanus@ducksong.com>
Fri, 18 Sep 2015 13:58:14 -0400
changeset 263752 f504caa27f0a
parent 263751 9ce35eb8d2c4
child 263753 5e0a3850571f
push id65417
push usermcmanus@ducksong.com
push date2015-09-22 16:12 +0000
treeherdermozilla-inbound@4d45c4323570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbagder
bugs366559
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 366559 - patch 5, fix nsHTTPCompressConv manual addref r=bagder
netwerk/streamconv/converters/nsHTTPCompressConv.cpp
--- a/netwerk/streamconv/converters/nsHTTPCompressConv.cpp
+++ b/netwerk/streamconv/converters/nsHTTPCompressConv.cpp
@@ -491,22 +491,20 @@ nsHTTPCompressConv::check_header(nsIInpu
 
 } // namespace net
 } // namespace mozilla
 
 nsresult
 NS_NewHTTPCompressConv(mozilla::net::nsHTTPCompressConv **aHTTPCompressConv)
 {
   NS_PRECONDITION(aHTTPCompressConv != nullptr, "null ptr");
-
   if (!aHTTPCompressConv) {
     return NS_ERROR_NULL_POINTER;
   }
 
-  *aHTTPCompressConv = new mozilla::net::nsHTTPCompressConv();
-
-  if (!*aHTTPCompressConv) {
+  nsRefPtr<mozilla::net::nsHTTPCompressConv> outVal =
+    new mozilla::net::nsHTTPCompressConv();
+  if (!outVal) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
-
-  NS_ADDREF(*aHTTPCompressConv);
+  outVal.forget(aHTTPCompressConv);
   return NS_OK;
 }