提交 0775bc0f 编写于 作者: G Garret Rieger

[subset] Fix hhea subsetting and clean up some memory leaks.

上级 b56c9384
......@@ -76,26 +76,29 @@ struct hmtxvmtx
return false;
}
hb_blob_t *src_blob = OT::Sanitizer<H>().sanitize (plan->source->reference_table (T::tableTag));
if (unlikely(!src_blob))
{
free(dest);
return false;
}
hb_blob_t *src_blob = OT::Sanitizer<H>().sanitize (plan->source->reference_table (H::tableTag));
unsigned int src_length;
const char *src_raw = hb_blob_get_data(src_blob, &src_length);
const char *src_raw = hb_blob_get_data (src_blob, &src_length);
hb_blob_destroy (src_blob);
if (src_length != sizeof (H)) {
free (dest);
return false;
}
memcpy(dest, src_raw, src_length);
H *table = (H *) dest;
table->numberOfLongMetrics.set(num_hmetrics);
table->numberOfLongMetrics.set (num_hmetrics);
hb_blob_t *dest_blob = hb_blob_create ((const char *)dest,
hb_blob_t *dest_blob = hb_blob_create ((const char *) dest,
dest_sz,
HB_MEMORY_MODE_READONLY,
/* userdata */ nullptr,
dest,
free);
return hb_subset_plan_add_table(plan, H::tableTag, dest_blob);
bool result = hb_subset_plan_add_table (plan, H::tableTag, dest_blob);
hb_blob_destroy (dest_blob);
return result;
}
inline bool subset (hb_subset_plan_t *plan) const
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册