From 4674d957a7637da9d242ff1bdba73a078f99a171 Mon Sep 17 00:00:00 2001 From: thestig Date: Tue, 16 Aug 2016 17:02:48 -0700 Subject: Fix a double free in CPDFSDK_PageView::IsValidAnnot(). BUG=635848 Review-Url: https://codereview.chromium.org/2242213004 --- fpdfsdk/fsdk_mgr.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp index f7fdae6dd8..144bea4bc8 100644 --- a/fpdfsdk/fsdk_mgr.cpp +++ b/fpdfsdk/fsdk_mgr.cpp @@ -1033,8 +1033,11 @@ bool CPDFSDK_PageView::IsValidAnnot(const CPDF_Annot* p) const { return false; const auto& annots = m_pAnnotList->All(); - std::unique_ptr annot(p); - return pdfium::ContainsValue(annots, annot); + auto it = std::find_if(annots.begin(), annots.end(), + [p](const std::unique_ptr& annot) { + return annot.get() == p; + }); + return it != annots.end(); } CPDFSDK_Annot* CPDFSDK_PageView::GetFocusAnnot() { -- cgit v1.2.3