[cairo-commit] 2 commits - src/cairo-pdf-surface.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Nov 21 13:48:15 UTC 2020
src/cairo-pdf-surface.c | 7 +++++++
1 file changed, 7 insertions(+)
New commits:
commit 6a713391fa4e90e998d8fd2bee248b8196501e62
Merge: 577477207 8913b6e2f
Author: Uli Schlachter <psychon at znc.in>
Date: Sat Nov 21 13:48:13 2020 +0000
Merge branch 'pdf-leak' into 'master'
pdf: fix leak of source surfaces
See merge request cairo/cairo!51
commit 8913b6e2fce42185c5ef8227be4d0b821d37f71d
Author: Félix Poisot <felix at lhfblc.fr>
Date: Sat Nov 21 11:58:59 2020 +0000
The array introduced in bff47b43 isn't cleared on surface finish
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 93fc9022c..4a7afe960 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -2207,6 +2207,7 @@ _cairo_pdf_surface_finish (void *abstract_surface)
cairo_pdf_resource_t catalog;
cairo_status_t status, status2;
int size, i;
+ cairo_pdf_source_surface_t doc_surface;
cairo_pdf_jbig2_global_t *global;
char *label;
@@ -2287,6 +2288,12 @@ _cairo_pdf_surface_finish (void *abstract_surface)
_cairo_array_fini (&surface->alpha_linear_functions);
_cairo_array_fini (&surface->page_patterns);
_cairo_array_fini (&surface->page_surfaces);
+
+ size = _cairo_array_num_elements (&surface->doc_surfaces);
+ for (i = 0; i < size; i++) {
+ _cairo_array_copy_element (&surface->doc_surfaces, i, &doc_surface);
+ cairo_surface_destroy (doc_surface.surface);
+ }
_cairo_array_fini (&surface->doc_surfaces);
_cairo_hash_table_foreach (surface->all_surfaces,
_cairo_pdf_source_surface_entry_pluck,
More information about the cairo-commit
mailing list