summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorOliver Chang <ochang@chromium.org>2015-12-18 14:31:41 -0800
committerOliver Chang <ochang@chromium.org>2015-12-18 14:31:41 -0800
commitd80677a1479287f0abea2362f933de4ab5a3654f (patch)
tree634a504ba4b890ff7fbd4b8a5bd0734ada34a7b3 /core
parent3da33812dd06a246aab800551fa2d77a52f5a5be (diff)
downloadpdfium-d80677a1479287f0abea2362f933de4ab5a3654f.tar.xz
Merge to XFA: Fix a memory leak in CPDF_DataAvail::CheckHintTables
R=thestig@chromium.org TBR=thestig@chromium.org BUG=pdfium:327 Original Review URL: https://codereview.chromium.org/1536113002 . (cherry picked from commit 6287ebc38e5aafc256b6248caae710ea09d0ede4) Review URL: https://codereview.chromium.org/1537123002 .
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;