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

Unified Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

Issue 1536113002: Fix a memory leak in CPDF_DataAvail::CheckHintTables (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Lei's suggestion Created 5 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index e098112ba1bb9aefa832dc95d40a08b0594a3703..97f17032b4d3c6317a2b080afa8930d1fdd69ccd 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -3600,10 +3600,11 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(IFX_DownloadHints* pHints) {
m_syntaxParser.InitParser(m_pFileRead, m_dwHeaderOffset);
nonstd::unique_ptr<CPDF_HintTables> pHintTables(
new CPDF_HintTables(this, pDict));
- CPDF_Stream* pHintStream = (CPDF_Stream*)ParseIndirectObjectAt(szHSStart, 0);
- if (pHintStream && pHintStream->GetType() == PDFOBJ_STREAM &&
- pHintTables->LoadHintStream(pHintStream))
- m_pHintTables.reset(pHintTables.release());
+ nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pHintStream(
+ ParseIndirectObjectAt(szHSStart, 0));
+ CPDF_Stream* pStream = ToStream(pHintStream.get());
+ if (pStream && pHintTables->LoadHintStream(pStream))
+ m_pHintTables = nonstd::move(pHintTables);
m_docStatus = PDF_DATAAVAIL_DONE;
return TRUE;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698