summaryrefslogtreecommitdiff
path: root/gpdl
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2022-11-22 15:36:15 +0000
committerRobin Watts <Robin.Watts@artifex.com>2022-11-22 15:37:45 +0000
commit81762a230ddb26749536e2c1061e68cd28530c68 (patch)
tree905145383c0e21c8e5e12deb0c44abb8bb67a829 /gpdl
parentbff645e38e347002e69f8eeb16dfe10fc4d24f00 (diff)
downloadghostpdl-81762a230ddb26749536e2c1061e68cd28530c68.tar.gz
Fix leaking PNG data from gpdl.
Diffstat (limited to 'gpdl')
-rw-r--r--gpdl/pngtop.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gpdl/pngtop.c b/gpdl/pngtop.c
index 8822ac2ba..db189dd04 100644
--- a/gpdl/pngtop.c
+++ b/gpdl/pngtop.c
@@ -678,11 +678,20 @@ do_impl_process(png_interp_instance_t *png, stream_cursor_read * pr, bool eof)
}
default:
case ii_state_flush:
+ if (png->png)
+ {
+ png_destroy_read_struct(&png->png, &png->png_info, NULL);
+ png->png = NULL;
+ png->png_info = NULL;
+ }
+
if (png->penum) {
(void)gs_image_cleanup_and_free_enum(png->penum, png->pgs);
png->penum = NULL;
}
+ gs_free_object(png->memory, png->buffer, "png_impl_process(buffer)");
+ png->buffer = NULL;
gs_free_object(png->memory, png->samples, "png_impl_process(samples)");
png->samples = NULL;
/* We want to bin any data we get up to, but not including