summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-11 14:10:44 -0700
committerLei Zhang <thestig@chromium.org>2015-08-11 14:10:44 -0700
commit0434f5b8ec8de0e89714f301826e9e3bbf617fbf (patch)
tree4bb621ff66387a50a0d6a03e0a6bc831dc4ab26b /core/src/fpdfapi/fpdf_parser
parentb9c3197d815295632be4612301ee635e5eb95df1 (diff)
downloadpdfium-0434f5b8ec8de0e89714f301826e9e3bbf617fbf.tar.xz
Merge to XFA: Fix a small leak in CPDF_DataAvail::CheckTrailer().
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1278713003 . (cherry picked from commit e42e23f34f0a685d6765ba547a26cc2e601efefd) Review URL: https://codereview.chromium.org/1272743005 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index f057ce7d90..5c085ab732 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -4113,6 +4113,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailerAppend(IFX_DownloadHints* pHints) {
}
return TRUE;
}
+
FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) {
int32_t iTrailerSize =
(int32_t)(m_Pos + 512 > m_dwFileLen ? m_dwFileLen - m_Pos : 512);
@@ -4130,13 +4131,14 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) {
CFX_SmartPointer<IFX_FileStream> file(
FX_CreateMemoryStream(pBuf, (size_t)iSize, FALSE));
m_syntaxParser.InitParser(file.Get(), 0);
- CPDF_Object* pTrailer = m_syntaxParser.GetObject(NULL, 0, 0, 0);
+ CPDF_Object* pTrailer = m_syntaxParser.GetObject(nullptr, 0, 0);
if (!pTrailer) {
m_Pos += m_syntaxParser.SavePos();
pHints->AddSegment(m_Pos, iTrailerSize);
return FALSE;
}
if (pTrailer->GetType() != PDFOBJ_DICTIONARY) {
+ pTrailer->Release();
return FALSE;
}
CPDF_Dictionary* pTrailerDict = pTrailer->GetDict();
@@ -4174,6 +4176,7 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) {
pHints->AddSegment(m_Pos, iTrailerSize);
return FALSE;
}
+
FX_BOOL CPDF_DataAvail::CheckPage(int32_t iPage, IFX_DownloadHints* pHints) {
while (TRUE) {
switch (m_docStatus) {