Index: Source/platform/image-encoders/skia/WEBPImageEncoder.cpp |
diff --git a/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp b/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp |
index e82e4bffa23940a81d8f68219ebb6a53e62eb6e9..5edcf10eee691e45c13728479856d42547163155 100644 |
--- a/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp |
+++ b/Source/platform/image-encoders/skia/WEBPImageEncoder.cpp |
@@ -54,9 +54,12 @@ static bool rgbPictureImport(const unsigned char* pixels, bool premultiplied, We |
// Write the RGB pixels to an rgb data buffer, alpha premultiplied, then import the rgb data. |
size_t pixelCount = picture->height * picture->width; |
- Vector<unsigned char> rgb(pixelCount * 3); |
- for (unsigned char* data = rgb.data(); pixelCount-- > 0; pixels += 4) { |
+ OwnPtr<unsigned char[]> rgb = adoptArrayPtr(new unsigned char[pixelCount * 3]); |
+ if (!rgb.get()) |
+ return false; |
+ |
+ for (unsigned char* data = rgb.get(); pixelCount-- > 0; pixels += 4) { |
unsigned char alpha = pixels[3]; |
if (alpha != 255) { |
*data++ = SkMulDiv255Round(pixels[0], alpha); |
@@ -69,7 +72,7 @@ static bool rgbPictureImport(const unsigned char* pixels, bool premultiplied, We |
} |
} |
- return importRGB(picture, rgb.data(), picture->width * 3); |
+ return importRGB(picture, rgb.get(), picture->width * 3); |
} |
template <bool Premultiplied> inline bool importPictureBGRX(const unsigned char* pixels, WebPPicture* picture) |