[ot-layout] Fix nullptr dereference.
If the `calloc` for `gsub_accels` or `gpos_accels` fails, then the unlikely branch afterwards can be taken, which frees up the `hb_ot_layout_t`, but since those fields can now be `nullptr`, then we don't want to dereference them.
This commit is contained in:
parent
0c66043a92
commit
148ca61075
|
@ -195,8 +195,10 @@ _hb_ot_layout_create (hb_face_t *face)
|
||||||
void
|
void
|
||||||
_hb_ot_layout_destroy (hb_ot_layout_t *layout)
|
_hb_ot_layout_destroy (hb_ot_layout_t *layout)
|
||||||
{
|
{
|
||||||
|
if (layout->gsub_accels)
|
||||||
for (unsigned int i = 0; i < layout->gsub_lookup_count; i++)
|
for (unsigned int i = 0; i < layout->gsub_lookup_count; i++)
|
||||||
layout->gsub_accels[i].fini ();
|
layout->gsub_accels[i].fini ();
|
||||||
|
if (layout->gpos_accels)
|
||||||
for (unsigned int i = 0; i < layout->gpos_lookup_count; i++)
|
for (unsigned int i = 0; i < layout->gpos_lookup_count; i++)
|
||||||
layout->gpos_accels[i].fini ();
|
layout->gpos_accels[i].fini ();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue