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

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

Issue 2194393002: Fix a leak with FPDFPageObj_NewImgeObj(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nit 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
« no previous file with comments | « core/fpdfapi/fpdf_page/fpdf_page_doc.cpp ('k') | core/fpdfapi/fpdf_page/include/cpdf_image.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 483a6b1fd66e49bdd8f9dc7b3b2222c540de0688..991e4b1e9ff899ab864843aca5a8f949af7eec03 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -785,13 +785,13 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream,
std::unique_ptr<CPDF_ImageObject> pImageObj(new CPDF_ImageObject);
if (pImage) {
- pImageObj->m_pImage =
- m_pDocument->GetPageData()->GetImage(pImage->GetStream());
+ pImageObj->SetUnownedImage(
+ m_pDocument->GetPageData()->GetImage(pImage->GetStream()));
} else if (pStream->GetObjNum()) {
- pImageObj->m_pImage = m_pDocument->LoadImageF(pStream);
+ pImageObj->SetUnownedImage(m_pDocument->LoadImageF(pStream));
} else {
- pImageObj->m_pImage = new CPDF_Image(m_pDocument);
- pImageObj->m_pImage->LoadImageF(pStream, bInline);
+ pImageObj->SetOwnedImage(
+ WrapUnique(new CPDF_Image(m_pDocument, pStream, bInline)));
}
SetGraphicStates(pImageObj.get(), pImageObj->GetImage()->IsMask(), FALSE,
FALSE);
« no previous file with comments | « core/fpdfapi/fpdf_page/fpdf_page_doc.cpp ('k') | core/fpdfapi/fpdf_page/include/cpdf_image.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698