From 9ad13b1e609a5973a9f9288978b720d82a1382f7 Mon Sep 17 00:00:00 2001 From: Grigori Goronzy Date: Sun, 19 Jul 2009 08:39:24 +0200 Subject: [PATCH] Fix drawing parser memory leak Always free the drawing glyph in ass_drawing_free; do not double free clip vector bitmap. --- libass/ass_drawing.c | 3 +-- libass/ass_render.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/libass/ass_drawing.c b/libass/ass_drawing.c index 091ec87..0b270c1 100644 --- a/libass/ass_drawing.c +++ b/libass/ass_drawing.c @@ -384,6 +384,7 @@ ass_drawing_t *ass_drawing_new(void *fontconfig_priv, ass_font_t *font, */ void ass_drawing_free(ass_drawing_t* drawing) { + FT_Done_Glyph((FT_Glyph) drawing->glyph); free(drawing->text); free(drawing); } @@ -481,5 +482,3 @@ FT_OutlineGlyph *ass_drawing_parse(ass_drawing_t *drawing, int raw_mode) drawing_free_tokens(drawing->tokens); return &drawing->glyph; } - - diff --git a/libass/ass_render.c b/libass/ass_render.c index aeeb0ac..b045a75 100644 --- a/libass/ass_render.c +++ b/libass/ass_render.c @@ -817,7 +817,6 @@ static void blend_vector_clip(ass_renderer_t *render_priv, } // Free clip vector and its bitmap, we don't need it anymore - FT_Done_Glyph((FT_Glyph) drawing->glyph); FT_Done_Glyph(glyph); ass_drawing_free(render_priv->state.clip_drawing); render_priv->state.clip_drawing = 0; -- 2.40.0