1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Prevent double frees in closing fonts provided by the Haiku font driver

* src/haikufont.c (haikufont_close): Clear INFO->metrics,
glyphs, be_font after they are released and do not attempt to
access them if NULL.  (bug#77478)
This commit is contained in:
Po Lu 2025-05-18 08:46:27 +08:00
parent f77f464637
commit b9b52f0092

View file

@ -890,25 +890,32 @@ haikufont_close (struct font *font)
return;
block_input ();
if (info && info->be_font)
if (info->be_font)
BFont_close (info->be_font);
for (i = 0; i < info->metrics_nrows; i++)
{
if (info->metrics[i])
xfree (info->metrics[i]);
}
if (info->metrics)
xfree (info->metrics);
for (i = 0; i < 0x100; ++i)
{
if (info->glyphs[i])
xfree (info->glyphs[i]);
for (i = 0; i < info->metrics_nrows; i++)
{
if (info->metrics[i])
xfree (info->metrics[i]);
}
xfree (info->metrics);
}
xfree (info->glyphs);
if (info->glyphs)
{
for (i = 0; i < 0x100; ++i)
{
if (info->glyphs[i])
xfree (info->glyphs[i]);
}
xfree (info->glyphs);
}
info->metrics = NULL;
info->glyphs = NULL;
info->be_font = NULL;
unblock_input ();
}