diff --git a/atom/common/api/atom_api_native_image.cc b/atom/common/api/atom_api_native_image.cc index c15e47407b6..4d5754ac970 100644 --- a/atom/common/api/atom_api_native_image.cc +++ b/atom/common/api/atom_api_native_image.cc @@ -268,11 +268,10 @@ v8::Local NativeImage::ToPNG(mate::Arguments* args) { const SkBitmap bitmap = image_.AsImageSkia().GetRepresentation(scale_factor).sk_bitmap(); - std::unique_ptr> encoded( - new std::vector()); - gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, encoded.get()); - const char* data = reinterpret_cast(encoded->data()); - size_t size = encoded->size(); + std::vector encoded; + gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &encoded); + const char* data = reinterpret_cast(encoded.data()); + size_t size = encoded.size(); return node::Buffer::Copy(args->isolate(), data, size).ToLocalChecked(); }