Skip to content

Commit

Permalink
fix: memory leak while encoding png from Canvas (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Feb 22, 2024
1 parent a70a8d4 commit 3f17b38
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions skia-c/skia_c.cpp
Expand Up @@ -218,8 +218,9 @@ extern "C"

void skiac_surface_png_data(skiac_surface *c_surface, skiac_sk_data *data)
{
auto image = SURFACE_CAST->makeImageSnapshot();
auto png_data = SkPngEncoder::Encode(nullptr, image.release(), SkPngEncoder::Options());
auto image = SURFACE_CAST->makeImageSnapshot().release();
auto png_data = SkPngEncoder::Encode(nullptr, image, SkPngEncoder::Options());
image->unref();
if (png_data)
{
data->ptr = png_data->bytes();
Expand Down

0 comments on commit 3f17b38

Please sign in to comment.