summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-11-09 09:57:03 -0800
committerLei Zhang <thestig@chromium.org>2015-11-09 09:57:03 -0800
commit4589243c204d6a8ef938f14d92c97b94aae38177 (patch)
tree883522c8e733ac67cc9b053e5962be8b01715301 /core
parente6cab2252ee48212420b52735afa6346bb256e2c (diff)
downloadpdfium-4589243c204d6a8ef938f14d92c97b94aae38177.tar.xz
Merge to XFA: Fix leaks in CPDF_SyntaxParser::ReadStream.
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1419533016 . (cherry picked from commit 2ce28d26ad16e11828b19f602fcc0ff625a23345) Review URL: https://codereview.chromium.org/1414963007 .
Diffstat (limited to 'core')
-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 cb63441d82..e49835496c 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -2400,6 +2400,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) {
@@ -2422,6 +2423,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
}
}
if (len < 0) {
+ pDict->Release();
return nullptr;
}
pDict->SetAtInteger(FX_BSTRC("Length"), len);
@@ -2429,6 +2431,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
m_Pos = streamStartPos;
}
if (len < 0) {
+ pDict->Release();
return nullptr;
}
uint8_t* pData = nullptr;