summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-11-09 09:50:13 -0800
committerLei Zhang <thestig@chromium.org>2015-11-09 09:50:13 -0800
commit2ce28d26ad16e11828b19f602fcc0ff625a23345 (patch)
treef7288a91a7c0b05cf33dde6f752ecb670bc7cfba /core/src/fpdfapi
parent9e7cd8ffb81c564e1102f6c6459ec0942a0b11ea (diff)
downloadpdfium-2ce28d26ad16e11828b19f602fcc0ff625a23345.tar.xz
Fix leaks in CPDF_SyntaxParser::ReadStream.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1419533016 .
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 4393bfbfe8..26f5595eaf 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -2401,6 +2401,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
}
if (endStreamOffset < 0 && endObjOffset < 0) {
// Can't find "endstream" or "endobj".
+ pDict->Release();
return nullptr;
}
if (endStreamOffset < 0 && endObjOffset >= 0) {
@@ -2423,6 +2424,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
}
}
if (len < 0) {
+ pDict->Release();
return nullptr;
}
pDict->SetAtInteger(FX_BSTRC("Length"), len);
@@ -2430,6 +2432,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
m_Pos = streamStartPos;
}
if (len < 0) {
+ pDict->Release();
return nullptr;
}
uint8_t* pData = nullptr;