 @@ -188,7 +188,12 @@ pdf_load_builtin_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontname,
  		if (!data)
  			fz_throw(ctx, FZ_ERROR_GENERIC, "cannot find builtin font: '%s'", fontname);
- 
+
 +#ifndef NOBUILTINFONT
  		fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, 0, 1);
 +#else

 	}
@@ -235,7 +245,12 @@ pdf_load_substitute_cjk_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fon
 			fz_throw(ctx, FZ_ERROR_GENERIC, "cannot find builtin CJK font");
 
 		/* A glyph bbox cache is too big for CJK fonts. */
+#ifndef NOBUILTINFONT
 		fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, index, 0);

+		free(data);
+#endif
 	}

 	if (!strcmp(clean_name, "Symbol") || !strcmp(clean_name, "ZapfDingbats"))
@@ -212,7 +217,12 @@ pdf_load_substitute_font(fz_context *ctx, pdf_font_desc *fontdesc, char *fontnam
 		if (!data)
 			fz_throw(ctx, FZ_ERROR_GENERIC, "cannot find substitute font");

+#ifndef NOBUILTINFONT
 		fontdesc->font = fz_new_font_from_memory(ctx, fontname, data, len, 0, 1);
+#else
