[face] Destroy blob if face closure can not be created (#2490)

This fixes issue #2489.
This commit is contained in:
Sebastian Rasmussen 2020-06-24 03:25:43 +08:00 committed by GitHub
parent 53b0a183c7
commit 12a9d57292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -200,10 +200,15 @@ hb_face_create (hb_blob_t *blob,
if (unlikely (!blob))
blob = hb_blob_get_empty ();
hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (hb_sanitize_context_t ().sanitize_blob<OT::OpenTypeFontFile> (hb_blob_reference (blob)), index);
blob = hb_sanitize_context_t ().sanitize_blob<OT::OpenTypeFontFile> (hb_blob_reference (blob));
hb_face_for_data_closure_t *closure = _hb_face_for_data_closure_create (blob, index);
if (unlikely (!closure))
{
hb_blob_destroy (blob);
return hb_face_get_empty ();
}
face = hb_face_create_for_tables (_hb_face_for_data_reference_table,
closure,