In lazy-loading, remember allocation failure
This commit is contained in:
parent
29fb0cb727
commit
ac274331c2
|
@ -447,10 +447,12 @@ struct hb_lazy_loader_t
|
||||||
{
|
{
|
||||||
p = (T *) calloc (1, sizeof (T));
|
p = (T *) calloc (1, sizeof (T));
|
||||||
if (unlikely (!p))
|
if (unlikely (!p))
|
||||||
return &OT::Null(T);
|
p = const_cast<T *> (&OT::Null(T));
|
||||||
|
else
|
||||||
p->init (face);
|
p->init (face);
|
||||||
if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), NULL, p)))
|
if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), NULL, p)))
|
||||||
{
|
{
|
||||||
|
if (p != &OT::Null(T))
|
||||||
p->fini ();
|
p->fini ();
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue