diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc index 5be055d34..c2431364d 100644 --- a/src/hb-ot-font.cc +++ b/src/hb-ot-font.cc @@ -447,11 +447,13 @@ struct hb_lazy_loader_t { p = (T *) calloc (1, sizeof (T)); if (unlikely (!p)) - return &OT::Null(T); - p->init (face); + p = const_cast (&OT::Null(T)); + else + p->init (face); if (unlikely (!hb_atomic_ptr_cmpexch (const_cast(&instance), NULL, p))) { - p->fini (); + if (p != &OT::Null(T)) + p->fini (); goto retry; } }