summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorOliver Chang <ochang@chromium.org>2015-12-18 14:27:56 -0800
committerOliver Chang <ochang@chromium.org>2015-12-18 14:27:56 -0800
commit6287ebc38e5aafc256b6248caae710ea09d0ede4 (patch)
tree7aaa362c7c0806af8edf9f9a54bcef38f86e4839 /core
parent178086485892c9bb6aa0bf57ee449b33705e71c0 (diff)
downloadpdfium-6287ebc38e5aafc256b6248caae710ea09d0ede4.tar.xz
Fix a memory leak in CPDF_DataAvail::CheckHintTables
R=thestig@chromium.org, dml@google.com BUG=pdfium:327 Review URL: https://codereview.chromium.org/1536113002 .
Diffstat (limited to 'core')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index e098112ba1..97f17032b4 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;