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 f504caa27f0aed5764fb5e58e1a3595756c6edef
parent 263751 9ce35eb8d2c4224929fd18fda7d4bdc6755533fc
child 263753 5e0a3850571f6b84ca301bd0f4bb2a1712730e94
push id65417
push usermcmanus@ducksong.com
push dateTue, 22 Sep 2015 16:12:32 +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;
 }