summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-10-26 15:43:44 -0700
committerLei Zhang <thestig@chromium.org>2015-10-26 15:43:44 -0700
commitd8155ac9f49a6e8bff8d195ce1235e1bb40fc129 (patch)
tree1f71d38274b52bae34459346f766b9f9a12e7e85 /core/src/fpdfapi/fpdf_page
parent811a4f617283a3ea22381a293b71d3c68c628905 (diff)
downloadpdfium-d8155ac9f49a6e8bff8d195ce1235e1bb40fc129.tar.xz
Merge to XFA: Remove default argument from CPDF_Dictionary::SetAt().
Also fix a potential object leak. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1414963005 . (cherry picked from commit f7992b39cec908e549fb995acae477a9efba538b) Review URL: https://codereview.chromium.org/1421253005 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index b86d00851c..694d5234a8 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -77,11 +77,14 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
}
CFX_ByteString key((const FX_CHAR*)m_pSyntax->GetWordBuf() + 1,
m_pSyntax->GetWordSize() - 1);
- CPDF_Object* pObj = m_pSyntax->ReadNextObject();
+ nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj(
+ m_pSyntax->ReadNextObject());
if (!key.IsEmpty()) {
- pDict->SetAt(key, pObj, m_pDocument);
- } else if (pObj) {
- pObj->Release();
+ FX_DWORD dwObjNum = pObj->GetObjNum();
+ if (dwObjNum)
+ pDict->SetAtReference(key, m_pDocument, dwObjNum);
+ else
+ pDict->SetAt(key, pObj.release());
}
}
_PDF_ReplaceAbbr(pDict);
@@ -95,7 +98,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
pCSObj = FindResourceObj(FX_BSTRC("ColorSpace"), name);
if (pCSObj && !pCSObj->GetObjNum()) {
pCSObj = pCSObj->Clone();
- pDict->SetAt(FX_BSTRC("ColorSpace"), pCSObj, m_pDocument);
+ pDict->SetAt(FX_BSTRC("ColorSpace"), pCSObj);
}
}
}