summaryrefslogtreecommitdiff
path: root/xfa/fgas/font
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-09-08 10:11:16 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-08 10:11:16 -0700
commit5c48effa667fbfc7a3ff7f03e73887347975bec5 (patch)
tree9c7586ccab22bbe4ef67e9180af0349358c81b72 /xfa/fgas/font
parent8c2a8cda1bdb9f57513af5a21a5d0ce32614e52b (diff)
downloadpdfium-5c48effa667fbfc7a3ff7f03e73887347975bec5.tar.xz
Fix leaks in class CFGAS_FontMgrImp
Two leak cases are addressed here: --In CFGAS_FontMgrImp::LoadFont(), calling LoadFace() is unnecessary since the following LoadFile() does the exact same thing. Calling LoadFace() without releasing the loaded face results in a leak; --|m_Hash2Fonts| in class CFGAS_FontMgrImp owns all the fonts stored in it. The fonts need to be deleted along with the container. BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2322483003
Diffstat (limited to 'xfa/fgas/font')
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index 7e5cfbb796..a0e7e39a40 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -591,6 +591,8 @@ CFGAS_FontMgrImp::~CFGAS_FontMgrImp() {
uint32_t dwHash;
CFX_ArrayTemplate<CFGAS_GEFont*>* pFonts;
m_Hash2Fonts.GetNextAssoc(pos, dwHash, pFonts);
+ for (int32_t i = 0; i < pFonts->GetSize(); i++)
+ delete pFonts->GetAt(i);
delete pFonts;
}
m_Hash2Fonts.RemoveAll();
@@ -845,11 +847,6 @@ CFGAS_GEFont* CFGAS_FontMgrImp::LoadFont(const CFX_WideString& wsFaceName,
if (!pFontStream)
return nullptr;
- if (!LoadFace(pFontStream, 0)) {
- pFontStream->Release();
- return nullptr;
- }
-
CFX_Font* pInternalFont = new CFX_Font();
if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) {
pFontStream->Release();