summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_flatten.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdf_flatten.cpp')
-rw-r--r--fpdfsdk/fpdf_flatten.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index cca28bc300..01f3cd7e1e 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -200,11 +200,13 @@ void SetPageContents(const ByteString& key,
pPage->ConvertToIndirectObjectFor(pdfium::page_object::kContents, pDocument);
if (!pContentsArray) {
pContentsArray = pDocument->NewIndirect<CPDF_Array>();
- auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pContentsStream);
- pAcc->LoadAllDataFiltered();
ByteString sStream = "q\n";
- ByteString sBody = ByteString(pAcc->GetData(), pAcc->GetSize());
- sStream = sStream + sBody + "\nQ";
+ {
+ auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pContentsStream);
+ pAcc->LoadAllDataFiltered();
+ sStream += ByteString(pAcc->GetData(), pAcc->GetSize());
+ sStream += "\nQ";
+ }
pContentsStream->SetDataAndRemoveFilter(sStream.AsRawSpan());
pContentsArray->Add(pContentsStream->MakeReference(pDocument));
pPage->SetFor(pdfium::page_object::kContents,