8208466: Fix potential memory leak in harfbuzz shaping

Reviewed-by: jdv, kaddepalli
This commit is contained in:
Phil Race 2018-07-31 12:23:55 -07:00
parent c57cfe6d14
commit 06932ae37c
2 changed files with 6 additions and 2 deletions

View File

@ -497,8 +497,10 @@ reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
return nullptr;
error = FT_Load_Sfnt_Table (ft_face, tag, 0, buffer, &length);
if (error)
if (error) {
free (buffer);
return nullptr;
}
return hb_blob_create ((const char *) buffer, length,
HB_MEMORY_MODE_WRITABLE,

View File

@ -193,8 +193,10 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan,
if (plan->shaper->data_create) {
plan->data = plan->shaper->data_create (plan);
if (unlikely (!plan->data))
if (unlikely (!plan->data)) {
free(plan);
return nullptr;
}
}
return plan;