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

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: fix 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..8a6e780e3963d9be3a1d64f147d048a7d2227a93 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -3600,9 +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);
+ nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pHintStream(
+ ParseIndirectObjectAt(szHSStart, 0));
+
Lei Zhang 2015/12/18 22:09:12 What do you think of this? nonstd::unique_ptr<CPD
Oliver Chang 2015/12/18 22:18:30 Thanks for the suggestion. I've simplified this a
if (pHintStream && pHintStream->GetType() == PDFOBJ_STREAM &&
- pHintTables->LoadHintStream(pHintStream))
+ pHintTables->LoadHintStream(pHintStream->AsStream()))
m_pHintTables.reset(pHintTables.release());
m_docStatus = PDF_DATAAVAIL_DONE;
« 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