LibGfx: Free the harfbuzz buffer when measuring text width

I spotted this leak when WebContent was exiting with ASan enabled on a
page with a media element. MediaPaintable calls Gfx::Font::width(),
which calls through to measure_text_width(), which then drops an
hb_buffer_t* without freeing it.
This commit is contained in:
Zaggy1024 2025-10-03 00:22:24 -05:00 committed by Jelle Raaijmakers
parent 400300945f
commit 1ae7ecc3e9
Notes: github-actions[bot] 2025-10-03 07:23:27 +00:00

View file

@ -191,6 +191,7 @@ float measure_text_width(Utf16View const& string, Font const& font, ShapeFeature
for (size_t i = 0; i < glyph_count; ++i) for (size_t i = 0; i < glyph_count; ++i)
point_x += positions[i].x_advance; point_x += positions[i].x_advance;
hb_buffer_destroy(buffer);
return point_x / text_shaping_resolution; return point_x / text_shaping_resolution;
} }