| Index: fpdfsdk/formfiller/cba_fontmap.cpp
|
| diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
|
| index 83e45791e20f7f7a5a4eaa317be4a840829970f3..057e32282076c685486675d3684c17e6196363b2 100644
|
| --- a/fpdfsdk/formfiller/cba_fontmap.cpp
|
| +++ b/fpdfsdk/formfiller/cba_fontmap.cpp
|
| @@ -171,24 +171,24 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
|
|
|
| CPDF_Dictionary* pStreamDict = pStream->GetDict();
|
| if (!pStreamDict) {
|
| - pStreamDict = new CPDF_Dictionary(m_pDocument->GetByteStringPool());
|
| - pStream->InitStream(nullptr, 0, pStreamDict);
|
| + auto pOwnedDict =
|
| + pdfium::MakeUnique<CPDF_Dictionary>(m_pDocument->GetByteStringPool());
|
| + pStreamDict = pOwnedDict.get();
|
| + pStream->InitStream(nullptr, 0, std::move(pOwnedDict));
|
| }
|
|
|
| - if (pStreamDict) {
|
| - CPDF_Dictionary* pStreamResList = pStreamDict->GetDictFor("Resources");
|
| - if (!pStreamResList)
|
| - pStreamResList = pStreamDict->SetNewFor<CPDF_Dictionary>("Resources");
|
| - CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictFor("Font");
|
| - if (!pStreamResFontList) {
|
| - pStreamResFontList = m_pDocument->NewIndirect<CPDF_Dictionary>();
|
| - pStreamResList->SetNewFor<CPDF_Reference>(
|
| - "Font", m_pDocument, pStreamResFontList->GetObjNum());
|
| - }
|
| - if (!pStreamResFontList->KeyExist(sAlias)) {
|
| - pStreamResFontList->SetNewFor<CPDF_Reference>(
|
| - sAlias, m_pDocument, pFont->GetFontDict()->GetObjNum());
|
| - }
|
| + CPDF_Dictionary* pStreamResList = pStreamDict->GetDictFor("Resources");
|
| + if (!pStreamResList)
|
| + pStreamResList = pStreamDict->SetNewFor<CPDF_Dictionary>("Resources");
|
| + CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictFor("Font");
|
| + if (!pStreamResFontList) {
|
| + pStreamResFontList = m_pDocument->NewIndirect<CPDF_Dictionary>();
|
| + pStreamResList->SetNewFor<CPDF_Reference>("Font", m_pDocument,
|
| + pStreamResFontList->GetObjNum());
|
| + }
|
| + if (!pStreamResFontList->KeyExist(sAlias)) {
|
| + pStreamResFontList->SetNewFor<CPDF_Reference>(
|
| + sAlias, m_pDocument, pFont->GetFontDict()->GetObjNum());
|
| }
|
| }
|
|
|
|
|