Bug 966870 - Use fallible allocation at nsStreamLoader::OnStartRequest. r=bsmedberg
authorPeiyong Lin <pylaurent1314@gmail.com>
Wed, 05 Feb 2014 17:46:05 -0500
changeset 178113 26cdcab860cffb608539302e024f8c3701b74153
parent 178112 727d19193bec3159ffdefe484ce41d44c22cbdd2
child 178114 3515cd83e2aa0296ccfbc3e24b562626458fc33e
push id5439
push userffxbld
push dateMon, 17 Mar 2014 23:08:15 +0000
treeherdermozilla-aurora@c0befb3c8038 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs966870
milestone30.0a1
Bug 966870 - Use fallible allocation at nsStreamLoader::OnStartRequest. r=bsmedberg
netwerk/base/src/nsStreamLoader.cpp
--- a/netwerk/base/src/nsStreamLoader.cpp
+++ b/netwerk/base/src/nsStreamLoader.cpp
@@ -73,17 +73,17 @@ nsStreamLoader::OnStartRequest(nsIReques
     if (contentLength >= 0) {
       if (contentLength > UINT32_MAX) {
         // Too big to fit into uint32, so let's bail.
         // XXX we should really make mAllocated and mLength 64-bit instead.
         return NS_ERROR_OUT_OF_MEMORY;
       }
       uint32_t contentLength32 = uint32_t(contentLength);
       // preallocate buffer
-      mData = static_cast<uint8_t*>(NS_Alloc(contentLength32));
+      mData = static_cast<uint8_t*>(moz_malloc(contentLength32));
       if (!mData) {
         return NS_ERROR_OUT_OF_MEMORY;
       }
       mAllocated = contentLength32;
     }
   }
   mContext = ctxt;
   return NS_OK;