From 35a2ed03352a1abc42e441ce5f52f2704de9be85 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 12 May 2007 12:36:47 +0100 Subject: [PATCH] [cairo-ft-font] Destroy surface if glyph transformation fails. As we allocated the surface we need to destroy it if we encounter an error. --- src/cairo-ft-font.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 8be1cae7b..7cdc3abb5 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -1964,9 +1964,12 @@ _cairo_ft_scaled_glyph_init (void *abstract_font, } else { status = _render_glyph_bitmap (face, &scaled_font->ft_options.base, &surface); - if (status == CAIRO_STATUS_SUCCESS && unscaled->have_shape) + if (status == CAIRO_STATUS_SUCCESS && unscaled->have_shape) { status = _transform_glyph_bitmap (&unscaled->current_shape, &surface); + if (status) + cairo_surface_destroy (&surface->base); + } } if (status) goto FAIL;