Bug 938612 - Ensure the image buffers for canvases are freed. r=smaug, a=bajaj
authorNathan Froyd <froydnj@gmail.com>
Tue, 19 Nov 2013 10:31:33 -0500
changeset 167491 7cffbb50b68cffa91bc5e6387d37d482c141b16e
parent 167490 b5eabc6c76ddd11ba2bfc7836cdefc0b5f15c969
child 167492 40dd183c2a20182490057bac03eb566348724111
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, bajaj
bugs938612
milestone27.0a2
Bug 938612 - Ensure the image buffers for canvases are freed. r=smaug, a=bajaj
content/canvas/src/CanvasRenderingContext2D.cpp
content/canvas/src/WebGLContext.cpp
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -1097,19 +1097,19 @@ CanvasRenderingContext2D::GetImageBuffer
   *aFormat = imgIEncoder::INPUT_FORMAT_HOSTARGB;
 }
 
 NS_IMETHODIMP
 CanvasRenderingContext2D::GetInputStream(const char *aMimeType,
                                          const PRUnichar *aEncoderOptions,
                                          nsIInputStream **aStream)
 {
-  uint8_t* imageBuffer = nullptr;
+  nsAutoArrayPtr<uint8_t> imageBuffer;
   int32_t format = 0;
-  GetImageBuffer(&imageBuffer, &format);
+  GetImageBuffer(getter_Transfers(imageBuffer), &format);
   if (!imageBuffer) {
     return NS_ERROR_FAILURE;
   }
 
   nsCString enccid("@mozilla.org/image/encoder;2?type=");
   enccid += aMimeType;
   nsCOMPtr<imgIEncoder> encoder = do_CreateInstance(enccid.get());
   if (!encoder) {
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -787,19 +787,19 @@ NS_IMETHODIMP
 WebGLContext::GetInputStream(const char* aMimeType,
                              const PRUnichar* aEncoderOptions,
                              nsIInputStream **aStream)
 {
     NS_ASSERTION(gl, "GetInputStream on invalid context?");
     if (!gl)
         return NS_ERROR_FAILURE;
 
-    uint8_t* imageBuffer = nullptr;
+    nsAutoArrayPtr<uint8_t> imageBuffer;
     int32_t format = 0;
-    GetImageBuffer(&imageBuffer, &format);
+    GetImageBuffer(getter_Transfers(imageBuffer), &format);
     if (!imageBuffer) {
         return NS_ERROR_FAILURE;
     }
 
     nsCString enccid("@mozilla.org/image/encoder;2?type=");
     enccid += aMimeType;
     nsCOMPtr<imgIEncoder> encoder = do_CreateInstance(enccid.get());
     if (!encoder) {