summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfeditpage.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-16 14:11:30 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-16 21:51:53 +0000
commit9792f16f3ef27a1e0c7f0526cc69637a158e3010 (patch)
tree861baddf94e96d7de9bc2c2b27409872d56ebcee /fpdfsdk/fpdfeditpage.cpp
parentcc205131b021ebded854958973f445ed121da1b8 (diff)
downloadpdfium-9792f16f3ef27a1e0c7f0526cc69637a158e3010.tar.xz
Properly ref-count CPDFXFA_Page
Change-Id: Ibd1ebe4191f61e20d815de7f1a1094d78b72e6a7 Reviewed-on: https://pdfium-review.googlesource.com/5391 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfeditpage.cpp')
-rw-r--r--fpdfsdk/fpdfeditpage.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp
index 739723f6ee..66ff028141 100644
--- a/fpdfsdk/fpdfeditpage.cpp
+++ b/fpdfsdk/fpdfeditpage.cpp
@@ -118,15 +118,15 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
pPageDict->SetNewFor<CPDF_Dictionary>("Resources");
#ifdef PDF_ENABLE_XFA
- CPDFXFA_Page* pPage =
- new CPDFXFA_Page(static_cast<CPDFXFA_Context*>(document), page_index);
- pPage->LoadPDFPage(pPageDict);
+ auto pXFAPage = pdfium::MakeRetain<CPDFXFA_Page>(
+ static_cast<CPDFXFA_Context*>(document), page_index);
+ pXFAPage->LoadPDFPage(pPageDict);
+ return pXFAPage.Leak();
#else // PDF_ENABLE_XFA
CPDF_Page* pPage = new CPDF_Page(pDoc, pPageDict, true);
pPage->ParseContent();
-#endif // PDF_ENABLE_XFA
-
return pPage;
+#endif // PDF_ENABLE_XFA
}
DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) {