summaryrefslogtreecommitdiff
path: root/xfa/fgas/font/fgas_stdfontmgr.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-09-01 17:10:12 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-01 17:10:12 -0700
commit6708106e6a3d54f3370c871ebf6643d1ecf58999 (patch)
tree97928e4492dd25692a7677b0e35339f8ee1614cf /xfa/fgas/font/fgas_stdfontmgr.cpp
parent7c5d090719a25f0c1b81fb6b46544b9394a7fdd2 (diff)
downloadpdfium-6708106e6a3d54f3370c871ebf6643d1ecf58999.tar.xz
Fix leaked internal font
In CFGAS_FontMgrImp::LoadFont(), a new internal font is created which is never released. It needs to be correctly marked as internal font to be released. Fix this by adding a boolean parameter and pass it along during the creation of the font. BUG=pdfium:242 Review-Url: https://codereview.chromium.org/2297303004
Diffstat (limited to 'xfa/fgas/font/fgas_stdfontmgr.cpp')
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index 7e5cfbb796..f79ad46e5e 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -850,13 +850,13 @@ CFGAS_GEFont* CFGAS_FontMgrImp::LoadFont(const CFX_WideString& wsFaceName,
return nullptr;
}
- CFX_Font* pInternalFont = new CFX_Font();
+ std::unique_ptr<CFX_Font> pInternalFont(new CFX_Font());
if (!pInternalFont->LoadFile(pFontStream, iFaceIndex)) {
pFontStream->Release();
return nullptr;
}
- CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(pInternalFont, this);
+ CFGAS_GEFont* pFont = CFGAS_GEFont::LoadFont(std::move(pInternalFont), this);
if (!pFont) {
pFontStream->Release();
return nullptr;