Bug 1331340 - FileReader should not continue when allocation fails. r=bkelly, a=lizzard
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 16 Jan 2017 17:35:40 +0100
changeset 368664 7d11cf1e5a7921d83fe0e905a1bf9dd4db3a0a0c
parent 368663 d31636b6dbbc24f3c0163740fba2b5f07c843d07
child 368665 9e033ffdf2fb9376ab6986e0f593e95bc85b163b
push id1369
push userjlorenzo@mozilla.com
push dateMon, 27 Feb 2017 14:59:41 +0000
treeherdermozilla-release@d75a1dba431f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly, lizzard
bugs1331340
milestone52.0a2
Bug 1331340 - FileReader should not continue when allocation fails. r=bkelly, a=lizzard
dom/base/FileReader.cpp
--- a/dom/base/FileReader.cpp
+++ b/dom/base/FileReader.cpp
@@ -416,16 +416,17 @@ FileReader::ReadFileContent(Blob& aBlob,
     return;
   }
 
   if (mDataFormat == FILE_AS_ARRAYBUFFER) {
     mFileData = js_pod_malloc<char>(mTotal);
     if (!mFileData) {
       NS_WARNING("Preallocation failed for ReadFileData");
       aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
+      return;
     }
   }
 
   aRv = DoAsyncWait();
   if (NS_WARN_IF(aRv.Failed())) {
     FreeFileData();
     return;
   }