From 9e05ee1e7bfb74d56d69620ad1e72b03e29b9237 Mon Sep 17 00:00:00 2001 From: tsepez Date: Mon, 21 Nov 2016 13:19:10 -0800 Subject: Make CPDF_Stream() take unique_ptr's to its dictionary. Review-Url: https://codereview.chromium.org/2520493002 --- fpdfsdk/fpdf_flatten.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'fpdfsdk/fpdf_flatten.cpp') diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index ccbb7b8765..e649bacf49 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -178,7 +178,8 @@ CFX_FloatRect CalculateRect(std::vector* pRectArray) { uint32_t NewIndirectContentsStream(const CFX_ByteString& key, CPDF_Document* pDocument) { CPDF_Stream* pNewContents = pDocument->NewIndirect( - nullptr, 0, new CPDF_Dictionary(pDocument->GetByteStringPool())); + nullptr, 0, + pdfium::MakeUnique(pDocument->GetByteStringPool())); CFX_ByteString sStream; sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str()); pNewContents->SetData(sStream.raw_str(), sStream.GetLength()); @@ -296,7 +297,8 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { pRes = pPageDict->SetNewFor("Resources"); CPDF_Stream* pNewXObject = pDocument->NewIndirect( - nullptr, 0, new CPDF_Dictionary(pDocument->GetByteStringPool())); + nullptr, 0, + pdfium::MakeUnique(pDocument->GetByteStringPool())); uint32_t dwObjNum = pNewXObject->GetObjNum(); CPDF_Dictionary* pPageXObject = pRes->GetDictFor("XObject"); -- cgit v1.2.3