From 12a9d572925a324be376440a1a26758eff832bcf Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Wed, 24 Jun 2020 03:25:43 +0800 Subject: [PATCH] [face] Destroy blob if face closure can not be created (#2490) This fixes issue #2489. --- src/hb-face.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hb-face.cc b/src/hb-face.cc index e4d8a3f36..95d3fc27f 100644 --- a/src/hb-face.cc +++ b/src/hb-face.cc @@ -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 (hb_blob_reference (blob)), index); + blob = hb_sanitize_context_t ().sanitize_blob (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,