summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-10-26 15:36:17 -0700
committerLei Zhang <thestig@chromium.org>2015-10-26 15:36:17 -0700
commitf7992b39cec908e549fb995acae477a9efba538b (patch)
tree394dcb06b0d8718aba6aa5e83dd67dd475276ca1 /core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
parentd50b640e42d46ab0f4d69cc58b3ba54e6137749c (diff)
downloadpdfium-f7992b39cec908e549fb995acae477a9efba538b.tar.xz
Remove default argument from CPDF_Dictionary::SetAt().
Also fix a potential object leak. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1414963005 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 27cc8688cc..cbbeee6024 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -845,9 +845,15 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
FX_POSITION pos = pTrailer->GetStartPos();
while (pos) {
CFX_ByteString key;
- CPDF_Object* pObj =
+ CPDF_Object* pElement =
pTrailer->GetNextElement(pos, key);
- m_pTrailer->SetAt(key, pObj->Clone(), m_pDocument);
+ FX_DWORD dwObjNum = pElement->GetObjNum();
+ if (dwObjNum) {
+ m_pTrailer->SetAtReference(key, m_pDocument,
+ dwObjNum);
+ } else {
+ m_pTrailer->SetAt(key, pElement->Clone());
+ }
}
pObj->Release();
} else {