Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1528)

Unified Diff: core/fpdfapi/parser/cpdf_parser.cpp

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (Closed)
Patch Set: Plug leaks Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/fpdfapi/parser/cpdf_parser.cpp
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index c43614f6286de49d4132014380db4d0ac3b319ec..6b49ad3641c22bdb203db0287a40327dccb12aff 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -802,16 +802,15 @@ bool CPDF_Parser::RebuildCrossRef() {
auto it = pTrailer->begin();
while (it != pTrailer->end()) {
const CFX_ByteString& key = it->first;
- CPDF_Object* pElement = it->second;
+ CPDF_Object* pElement = it->second.get();
++it;
uint32_t dwObjNum =
pElement ? pElement->GetObjNum() : 0;
if (dwObjNum) {
- m_pTrailer->SetReferenceFor(key, m_pDocument,
- dwObjNum);
+ m_pTrailer->SetNewFor<CPDF_Reference>(
+ key, m_pDocument, dwObjNum);
} else {
- m_pTrailer->SetFor(key,
- pElement->Clone().release());
+ m_pTrailer->SetFor(key, pElement->Clone());
}
}
}
@@ -1075,7 +1074,7 @@ CPDF_Array* CPDF_Parser::GetIDArray() {
if (CPDF_Reference* pRef = pID->AsReference()) {
pID = ParseIndirectObject(nullptr, pRef->GetRefObjNum()).release();
- m_pTrailer->SetFor("ID", pID);
+ m_pTrailer->SetFor("ID", pdfium::WrapUnique(pID));
}
return ToArray(pID);
}

Powered by Google App Engine
This is Rietveld 408576698