summaryrefslogtreecommitdiff
path: root/xfa/fgas/font/cfgas_fontmgr.cpp
diff options
context:
space:
mode:
authorChris Palmer <palmer@chromium.org>2017-06-22 10:10:17 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-06-22 17:41:45 +0000
commit7726a581626bbb72d6ab294ae1adbad4ca10dfb0 (patch)
treeb9ab95fb40d0f05ef1cc2e3010d5ee75830714f1 /xfa/fgas/font/cfgas_fontmgr.cpp
parent9a25eded6f4afe3f4815a00b34b31d3a0fbadb69 (diff)
downloadpdfium-7726a581626bbb72d6ab294ae1adbad4ca10dfb0.tar.xz
Add a |gGeneralPartitionAllocator| and use it in the |FX_*Alloc| wrappers.chromium/3142chromium/3141chromium/3140chromium/3139
BUG=pdfium:690 Change-Id: I922279e4bdc8b411f47f49798155e8f9118c1396 Reviewed-on: https://pdfium-review.googlesource.com/6552 Commit-Queue: Chris Palmer <palmer@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'xfa/fgas/font/cfgas_fontmgr.cpp')
-rw-r--r--xfa/fgas/font/cfgas_fontmgr.cpp9
1 files changed, 7 insertions, 2 deletions
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<FXFT_Stream>(ft_scalloc(sizeof(FXFT_StreamRec), 1));
memset(ftStream, 0, sizeof(FXFT_StreamRec));
ftStream->base = nullptr;
ftStream->descriptor.pointer = static_cast<void*>(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;
}