Fix a double free in CPDFSDK_PageView::IsValidAnnot().
BUG=635848
Review-Url: https://codereview.chromium.org/2242213004
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index f7fdae6..144bea4 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -1033,8 +1033,11 @@
return false;
const auto& annots = m_pAnnotList->All();
- std::unique_ptr<const CPDF_Annot> annot(p);
- return pdfium::ContainsValue(annots, annot);
+ auto it = std::find_if(annots.begin(), annots.end(),
+ [p](const std::unique_ptr<CPDF_Annot>& annot) {
+ return annot.get() == p;
+ });
+ return it != annots.end();
}
CPDFSDK_Annot* CPDFSDK_PageView::GetFocusAnnot() {