diff options
author | weili <weili@chromium.org> | 2016-09-01 14:39:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-09-01 14:39:41 -0700 |
commit | 7c5d090719a25f0c1b81fb6b46544b9394a7fdd2 (patch) | |
tree | 8c341dd8f815902f77c7b6a3a569b8d24944b2c2 /core/fpdfdoc/cpdf_annotlist.cpp | |
parent | 4bae296c1eee7a1ecae8bab3d59dd9430218f730 (diff) | |
download | pdfium-7c5d090719a25f0c1b81fb6b46544b9394a7fdd2.tar.xz |
Fix leaks due to created popup annotationschromium/2847
When we create popup annotations, we also create the dictionary
associated with it. For regular annotations, the dictionary
associated with an annotation is not owned by annotation,
and will be released separately. But our created dictionary is not
associated with any other data structure, it would be leaked if not
released by the associated annotation.
Add a boolean to indicate the ownership to the dictionary, and release
the owned dictionary during the destruction of an annotation.
BUG=pdfium:242
Review-Url: https://codereview.chromium.org/2301613002
Diffstat (limited to 'core/fpdfdoc/cpdf_annotlist.cpp')
-rw-r--r-- | core/fpdfdoc/cpdf_annotlist.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index 61122ed59b..631978175c 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -43,7 +43,7 @@ std::unique_ptr<CPDF_Annot> CreatePopupAnnot(CPDF_Annot* pAnnot, pAnnotDict->SetAtInteger("F", 0); std::unique_ptr<CPDF_Annot> pPopupAnnot( - new CPDF_Annot(pAnnotDict, pDocument)); + new CPDF_Annot(pAnnotDict, pDocument, true)); pAnnot->SetPopupAnnot(pPopupAnnot.get()); return pPopupAnnot; } @@ -83,7 +83,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) continue; m_AnnotList.push_back( - std::unique_ptr<CPDF_Annot>(new CPDF_Annot(pDict, m_pDocument))); + std::unique_ptr<CPDF_Annot>(new CPDF_Annot(pDict, m_pDocument, false))); if (bRegenerateAP && pDict->GetStringBy("Subtype") == "Widget" && CPDF_InterForm::IsUpdateAPEnabled()) { FPDF_GenerateAP(m_pDocument, pDict); |