This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/8.0 in repository ffmpeg.
commit 5aa76c151d4f48e98c5177afe083210c84c01b63 Author: Michael Niedermayer <[email protected]> AuthorDate: Thu May 28 23:43:08 2026 +0200 Commit: Michael Niedermayer <[email protected]> CommitDate: Sun Jun 14 04:59:05 2026 +0200 avfilter/vf_drawtext: shape_text_hb() free allocated things on error Fixes: memleak Found-by: Fairy Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit 77554d85d7ff1eb8ba1719ba2c917221e2d4ca3a) Signed-off-by: Michael Niedermayer <[email protected]> --- libavfilter/vf_drawtext.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index 2360db0ff5..b129c45a94 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -1370,23 +1370,25 @@ static int draw_glyphs(DrawTextContext *s, AVFrame *frame, static int shape_text_hb(DrawTextContext *s, HarfbuzzData* hb, const char* text, int textLen) { hb->buf = hb_buffer_create(); - if(!hb_buffer_allocation_successful(hb->buf)) { - return AVERROR(ENOMEM); - } + if(!hb_buffer_allocation_successful(hb->buf)) + goto fail; hb_buffer_set_direction(hb->buf, HB_DIRECTION_LTR); hb_buffer_set_script(hb->buf, HB_SCRIPT_LATIN); hb_buffer_set_language(hb->buf, hb_language_from_string("en", -1)); hb_buffer_guess_segment_properties(hb->buf); hb->font = hb_ft_font_create_referenced(s->face); - if(hb->font == NULL) { - return AVERROR(ENOMEM); - } + if(hb->font == NULL) + goto fail; hb_buffer_add_utf8(hb->buf, text, textLen, 0, -1); hb_shape(hb->font, hb->buf, NULL, 0); hb->glyph_info = hb_buffer_get_glyph_infos(hb->buf, &hb->glyph_count); hb->glyph_pos = hb_buffer_get_glyph_positions(hb->buf, &hb->glyph_count); return 0; +fail: + hb_buffer_destroy(hb->buf); + hb->buf = NULL; + return AVERROR(ENOMEM); } static void hb_destroy(HarfbuzzData *hb) _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
