Bug 1331340 - FileReader should not continue when allocation fails, r=bkelly
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 16 Jan 2017 17:35:40 +0100
changeset 357619 99ea5dbd29164d1d0a9bc3397b9ae5e1e57290be
parent 357618 68aff122042fd472f4dcc05f259929a8b7efe894
child 357620 88030580b14bb253a55bc174c987a9fa43c3fb55
child 357631 1a71a0d9aa90635e6a4ef7e0df5272c52fd0ae54
push id10621
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 16:02:43 +0000
treeherdermozilla-aurora@dca7b42e6c67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1331340
milestone53.0a1
Bug 1331340 - FileReader should not continue when allocation fails, r=bkelly
dom/file/FileReader.cpp
--- a/dom/file/FileReader.cpp
+++ b/dom/file/FileReader.cpp
@@ -413,16 +413,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;
   }