From 4569a0642efc805b16cec9924f2bf19eb7db2261 Mon Sep 17 00:00:00 2001 From: Massimo Valentini Date: Sun, 19 Jul 2015 16:29:55 +0200 Subject: [PATCH] cairo-script-surface: plug a memory leak --- src/cairo-script-surface.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c index a4cefde..93504fa 100644 --- a/src/cairo-script-surface.c +++ b/src/cairo-script-surface.c @@ -204,7 +204,7 @@ static void _cairo_script_implicit_context_init (cairo_script_implicit_context_t *cr); static void -_cairo_script_implicit_context_reset (cairo_script_implicit_context_t *cr); +_cairo_script_implicit_context_fini (cairo_script_implicit_context_t *cr); static void _bitmap_release_id (struct _bitmap *b, unsigned long token) @@ -594,7 +594,8 @@ _emit_context (cairo_script_surface_t *surface) _cairo_output_stream_printf (ctx->stream, "s%u context\n", surface->base.unique_id); - _cairo_script_implicit_context_reset (&surface->cr); + _cairo_script_implicit_context_fini (&surface->cr); + _cairo_script_implicit_context_init (&surface->cr); _cairo_surface_clipper_reset (&surface->clipper); } else { int depth = target_depth (surface); @@ -1172,6 +1173,7 @@ _emit_recording_surface_pattern (cairo_script_surface_t *surface, old_cr = surface->cr; _cairo_script_implicit_context_init (&surface->cr); status = _cairo_recording_surface_replay (&source->base, &similar->base); + _cairo_script_implicit_context_fini (&surface->cr); surface->cr = old_cr; if (unlikely (status)) { @@ -3053,6 +3055,7 @@ _emit_scaled_glyph_vector (cairo_script_surface_t *surface, _cairo_script_implicit_context_init (&surface->cr); status = _cairo_recording_surface_replay (scaled_glyph->recording_surface, &surface->base); + _cairo_script_implicit_context_fini (&surface->cr); surface->cr = old_cr; _cairo_output_stream_puts (ctx->stream, "} >> set\n"); @@ -3619,15 +3622,13 @@ _cairo_script_implicit_context_init (cairo_script_implicit_context_t *cr) } static void -_cairo_script_implicit_context_reset (cairo_script_implicit_context_t *cr) +_cairo_script_implicit_context_fini (cairo_script_implicit_context_t *cr) { free (cr->current_style.dash); cr->current_style.dash = NULL; _cairo_pattern_fini (&cr->current_source.base); _cairo_path_fixed_fini (&cr->current_path); - - _cairo_script_implicit_context_init (cr); } static cairo_script_surface_t * -- 2.4.3