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 462246 99ea5dbd29164d1d0a9bc3397b9ae5e1e57290be
parent 462245 68aff122042fd472f4dcc05f259929a8b7efe894
child 462247 1a71a0d9aa90635e6a4ef7e0df5272c52fd0ae54
child 462285 88030580b14bb253a55bc174c987a9fa43c3fb55
push id41683
push userbmo:steffen.wilberg@web.de
push dateMon, 16 Jan 2017 21:50:32 +0000
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;
   }