summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/parser/cpdf_document_unittest.cpp3
-rw-r--r--core/fpdfapi/parser/cpdf_indirect_object_holder.cpp4
2 files changed, 2 insertions, 5 deletions
diff --git a/core/fpdfapi/parser/cpdf_document_unittest.cpp b/core/fpdfapi/parser/cpdf_document_unittest.cpp
index 71716a649e..16d0ade069 100644
--- a/core/fpdfapi/parser/cpdf_document_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_document_unittest.cpp
@@ -69,8 +69,7 @@ class CPDF_TestDocumentForPages : public CPDF_Document {
CPDF_Dictionary* pagesDict = CreatePageTreeNode(allPages, this, 7);
m_pOwnedRootDict.reset(new CPDF_Dictionary());
- m_pOwnedRootDict->SetReferenceFor("Pages", this,
- AddIndirectObject(pagesDict));
+ m_pOwnedRootDict->SetReferenceFor("Pages", this, pagesDict->GetObjNum());
m_pRootDict = m_pOwnedRootDict.get();
m_PageList.SetSize(7);
}
diff --git a/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp b/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
index d3204e04e5..720fe18606 100644
--- a/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
+++ b/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
@@ -43,9 +43,7 @@ CPDF_Object* CPDF_IndirectObjectHolder::ParseIndirectObject(uint32_t objnum) {
}
uint32_t CPDF_IndirectObjectHolder::AddIndirectObject(CPDF_Object* pObj) {
- if (pObj->m_ObjNum)
- return pObj->m_ObjNum;
-
+ CHECK(!pObj->m_ObjNum);
m_LastObjNum++;
m_IndirectObjs[m_LastObjNum].release(); // TODO(tsepez): stop this leak.
m_IndirectObjs[m_LastObjNum].reset(pObj);