Index: fpdfsdk/cpdfsdk_baannot.cpp |
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp |
index 9fb1e88a84b2900b45cf7e829f5abb4b1435a037..869da36905837f585a93eac40938233d4909d4a2 100644 |
--- a/fpdfsdk/cpdfsdk_baannot.cpp |
+++ b/fpdfsdk/cpdfsdk_baannot.cpp |
@@ -323,19 +323,16 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, |
CPDF_Dictionary* pStreamDict = pStream->GetDict(); |
if (!pStreamDict) { |
- pStreamDict = |
- new CPDF_Dictionary(m_pAnnot->GetDocument()->GetByteStringPool()); |
+ auto pNewDict = pdfium::MakeUnique<CPDF_Dictionary>( |
+ m_pAnnot->GetDocument()->GetByteStringPool()); |
+ pStreamDict = pNewDict.get(); |
pStreamDict->SetNewFor<CPDF_Name>("Type", "XObject"); |
pStreamDict->SetNewFor<CPDF_Name>("Subtype", "Form"); |
pStreamDict->SetNewFor<CPDF_Number>("FormType", 1); |
- pStream->InitStream(nullptr, 0, pStreamDict); |
+ pStream->InitStream(nullptr, 0, std::move(pNewDict)); |
} |
- |
- if (pStreamDict) { |
- pStreamDict->SetMatrixFor("Matrix", matrix); |
- pStreamDict->SetRectFor("BBox", rcBBox); |
- } |
- |
+ pStreamDict->SetMatrixFor("Matrix", matrix); |
+ pStreamDict->SetRectFor("BBox", rcBBox); |
pStream->SetData((uint8_t*)sContents.c_str(), sContents.GetLength()); |
} |