Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(847)

Unified Diff: core/fpdfapi/fpdf_page/fpdf_page_doc.cpp

Issue 2194393002: Fix a leak with FPDFPageObj_NewImgeObj(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 059679a8cda1f3d7284c6278e73b074697a2b9b7..f9eae859758a41f73469a6afa638b3cb44e3badb 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -439,6 +439,18 @@ void CPDF_DocPageData::ReleaseImage(const CPDF_Object* pImageStream) {
m_ImageMap.erase(it);
}
+bool CPDF_DocPageData::HasImage(const CPDF_Object* pImageStream) const {
Wei Li 2016/08/04 18:00:39 Why adding an extra function which does the same a
Lei Zhang 2016/08/04 21:58:25 CPDF_ImageObject needs to know if CPDF_ImageObject
Wei Li 2016/08/04 23:36:39 I think you may keep the change of patch 1 and let
+ if (!pImageStream)
+ return false;
+
+ uint32_t dwObjNum = pImageStream->GetObjNum();
+ if (!dwObjNum)
+ return false;
+
+ auto it = m_ImageMap.find(dwObjNum);
+ return it != m_ImageMap.end() && it->second;
+}
+
CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(
CPDF_Stream* pIccProfileStream) {
if (!pIccProfileStream)

Powered by Google App Engine
This is Rietveld 408576698