[ft] Better handle allocation failures

Fixes https://github.com/harfbuzz/harfbuzz/issues/2513
diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 073fd4b..2680873 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -92,9 +92,7 @@
 _hb_ft_font_create (FT_Face ft_face, bool symbol, bool unref)
 {
   hb_ft_font_t *ft_font = (hb_ft_font_t *) calloc (1, sizeof (hb_ft_font_t));
-
-  if (unlikely (!ft_font))
-    return nullptr;
+  if (unlikely (!ft_font)) return nullptr;
 
   ft_font->lock.init ();
   ft_font->ft_face = ft_face;
@@ -120,9 +118,6 @@
 {
   hb_ft_font_t *ft_font = (hb_ft_font_t *) data;
 
-  if (unlikely (!ft_font))
-    return;
-
   ft_font->advance_cache.fini ();
 
   if (ft_font->unref)
@@ -623,9 +618,12 @@
 {
   bool symbol = ft_face->charmap && ft_face->charmap->encoding == FT_ENCODING_MS_SYMBOL;
 
+  hb_ft_font_t *ft_font = _hb_ft_font_create (ft_face, symbol, unref);
+  if (unlikely (!ft_font)) return;
+
   hb_font_set_funcs (font,
 		     _hb_ft_get_font_funcs (),
-		     _hb_ft_font_create (ft_face, symbol, unref),
+		     ft_font,
 		     _hb_ft_font_destroy);
 }
 
@@ -833,9 +831,6 @@
 
   hb_ft_font_t *ft_font = (hb_ft_font_t *) font->user_data;
 
-  if (unlikely (!ft_font))
-	  return;
-
   FT_Face ft_face = ft_font->ft_face;
 
   hb_font_set_scale (font,