mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-13 08:42:59 +00:00
[VARC] Fix resource leak
This commit is contained in:
parent
827be1b23c
commit
e76b689fe1
1 changed files with 9 additions and 4 deletions
|
@ -162,10 +162,10 @@ struct VARC
|
|||
{
|
||||
if (!table->has_data ()) return false;
|
||||
|
||||
hb_glyf_scratch_t *scratch;
|
||||
hb_glyf_scratch_t *scratch = nullptr;
|
||||
|
||||
// Borrow the cached strach buffer.
|
||||
do
|
||||
retry:
|
||||
{
|
||||
scratch = cached_scratch.get_relaxed ();
|
||||
if (!scratch)
|
||||
|
@ -173,10 +173,15 @@ struct VARC
|
|||
scratch = (hb_glyf_scratch_t *) hb_calloc (1, sizeof (hb_glyf_scratch_t));
|
||||
if (unlikely (!scratch))
|
||||
return true;
|
||||
break;
|
||||
|
||||
if (!cached_scratch.cmpexch (scratch, nullptr))
|
||||
{
|
||||
scratch->~hb_glyf_scratch_t ();
|
||||
hb_free (scratch);
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (!cached_scratch.cmpexch (scratch, nullptr));
|
||||
|
||||
bool ret = table->get_path (font, gid, draw_session, *scratch);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue