summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_formfillenvironment.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-16 15:33:20 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-16 23:26:47 +0000
commitfe91c6c8211cec39f871d9202556e1957bf81983 (patch)
treeb7e763f7affe4c71de67393fbd320c1fed477e0f /fpdfsdk/cpdfsdk_formfillenvironment.cpp
parent365333552cf67b7c97c4093177e7ed7b43f540ab (diff)
downloadpdfium-fe91c6c8211cec39f871d9202556e1957bf81983.tar.xz
Be skeptical of bare |new|s.
In particular, prefer an explicit .release() call when handing ownership of an object to a caller across a C-API. Change-Id: Ic3784e9d0b2d378a08d388989eaea7c9166bacd1 Reviewed-on: https://pdfium-review.googlesource.com/5470 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_formfillenvironment.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_formfillenvironment.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index e1b34ce51a..f17d28b9b6 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -7,6 +7,7 @@
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include <memory>
+#include <utility>
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfdoc/cpdf_docjsactions.h"
@@ -568,8 +569,10 @@ CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetPageView(
if (!renew)
return nullptr;
- CPDFSDK_PageView* pPageView = new CPDFSDK_PageView(this, pUnderlyingPage);
- m_PageMap[pUnderlyingPage].reset(pPageView);
+ auto pNew = pdfium::MakeUnique<CPDFSDK_PageView>(this, pUnderlyingPage);
+ CPDFSDK_PageView* pPageView = pNew.get();
+ m_PageMap[pUnderlyingPage] = std::move(pNew);
+
// Delay to load all the annotations, to avoid endless loop.
pPageView->LoadFXAnnots();
return pPageView;