summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTazyFoundSoup <gardendistrict0x0@outlook.com>2026-04-14 19:06:44 +1000
committerTazyFoundSoup <gardendistrict0x0@outlook.com>2026-04-14 19:06:44 +1000
commitbfb9fbd2fb8558532eb2223ec0281a04b2043c73 (patch)
treec4a4f34b6fb688ae3bc12aa221fa84af6a12a724 /src
parent3bc1075a710d13835380dd7ad382ea16a66936dd (diff)
feat(png): Add ff_close_png function
Diffstat (limited to 'src')
-rw-r--r--src/format/image/png.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/format/image/png.c b/src/format/image/png.c
index 15f05b8..f42761b 100644
--- a/src/format/image/png.c
+++ b/src/format/image/png.c
@@ -449,4 +449,24 @@ ff_result ff_png_trans_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx
}
-// TODO: Add ff_close_png \ No newline at end of file
+ff_result ff_close_png(ff_ctx* ctx, ff_png_ctx *png_ctx)
+{
+ if (!png_ctx) return FF_RESULT_OK;
+
+ if (png_ctx->data.pixels) {
+ ctx->allocator.ff_free(png_ctx->data.pixels);
+ png_ctx->data.pixels = NULL;
+ ff_dprintf(ctx, "png: successfully freed pixels\n");
+ }
+
+ if (png_ctx->data.imap) {
+ ctx->allocator.ff_free(png_ctx->data.imap);
+ png_ctx->data.imap = NULL;
+ ff_dprintf(ctx, "png: successfully freed index map\n");
+ }
+
+ ctx->allocator.ff_free(png_ctx);
+ ff_dprintf(ctx, "png: successfully freed png context\n");
+
+ return FF_RESULT_OK;
+} \ No newline at end of file