Fix a small leak in CPDF_DataAvail::CheckTrailer().
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1278713003 .
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 23efb52..21b2fba 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -4104,6 +4104,7 @@
}
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);
@@ -4121,13 +4122,14 @@
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();
@@ -4165,6 +4167,7 @@
pHints->AddSegment(m_Pos, iTrailerSize);
return FALSE;
}
+
FX_BOOL CPDF_DataAvail::CheckPage(int32_t iPage, IFX_DownloadHints* pHints) {
while (TRUE) {
switch (m_docStatus) {