[subset] Fix blob leak of _subset2 when returns early

Fixes https://crbug.com/oss-fuzz/16639
This commit is contained in:
Ebrahim Byagowi 2019-08-23 16:47:15 +04:30
parent 541f3c2d7d
commit 28aba780c4
2 changed files with 2 additions and 0 deletions

View File

@ -82,6 +82,7 @@ _subset2 (hb_subset_plan_t *plan)
if (unlikely (!buf.alloc (buf_size))) if (unlikely (!buf.alloc (buf_size)))
{ {
DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size); DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c failed to allocate %u bytes.", HB_UNTAG (tag), buf_size);
hb_blob_destroy (source_blob);
return false; return false;
} }
retry: retry:
@ -96,6 +97,7 @@ _subset2 (hb_subset_plan_t *plan)
if (unlikely (!buf.alloc (buf_size))) if (unlikely (!buf.alloc (buf_size)))
{ {
DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.", HB_UNTAG (tag), buf_size); DEBUG_MSG(SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.", HB_UNTAG (tag), buf_size);
hb_blob_destroy (source_blob);
return false; return false;
} }
goto retry; goto retry;