From 7726a581626bbb72d6ab294ae1adbad4ca10dfb0 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Thu, 22 Jun 2017 10:10:17 -0700 Subject: Add a |gGeneralPartitionAllocator| and use it in the |FX_*Alloc| wrappers. BUG=pdfium:690 Change-Id: I922279e4bdc8b411f47f49798155e8f9118c1396 Reviewed-on: https://pdfium-review.googlesource.com/6552 Commit-Queue: Chris Palmer Reviewed-by: Lei Zhang --- xfa/fgas/font/cfgas_fontmgr.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'xfa/fgas/font') diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp index 8430d4f834..6f86c7ca07 100644 --- a/xfa/fgas/font/cfgas_fontmgr.cpp +++ b/xfa/fgas/font/cfgas_fontmgr.cpp @@ -940,7 +940,12 @@ FXFT_Face CFGAS_FontMgr::LoadFace( if (!library) return nullptr; - FXFT_Stream ftStream = FX_Alloc(FXFT_StreamRec, 1); + // TODO(palmer): This memory will be freed with |ft_free| (which is |free|). + // Ultimately, we want to change this to: + // FXFT_Stream ftStream = FX_Alloc(FXFT_StreamRec, 1); + // https://bugs.chromium.org/p/pdfium/issues/detail?id=690 + FXFT_Stream ftStream = + static_cast(ft_scalloc(sizeof(FXFT_StreamRec), 1)); memset(ftStream, 0, sizeof(FXFT_StreamRec)); ftStream->base = nullptr; ftStream->descriptor.pointer = static_cast(pFontStream.Get()); @@ -956,7 +961,7 @@ FXFT_Face CFGAS_FontMgr::LoadFace( FXFT_Face pFace = nullptr; if (FXFT_Open_Face(library, &ftArgs, iFaceIndex, &pFace)) { - FX_Free(ftStream); + ft_sfree(ftStream); return nullptr; } -- cgit v1.2.3