summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-09-11 07:59:18 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-11 07:59:18 +0000
commitbb06ae5ad0b6389490befc6831517ab383e94031 (patch)
tree97e9e2367db537f6a4f459481d77103973450b3c /xfa
parentc2f404f993f13d303f9e47d2f97aff727becac7d (diff)
downloadpdfium-bb06ae5ad0b6389490befc6831517ab383e94031.tar.xz
Make flate decode functions' buffer out parameter unique_ptrs.
Change-Id: Idb14846e87a8287dd911b0a2f7a32146e86c2af7 Reviewed-on: https://pdfium-review.googlesource.com/41853 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fxfa/parser/cxfa_localemgr.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/xfa/fxfa/parser/cxfa_localemgr.cpp b/xfa/fxfa/parser/cxfa_localemgr.cpp
index 55ba04bbb0..fc3b1ce9cb 100644
--- a/xfa/fxfa/parser/cxfa_localemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_localemgr.cpp
@@ -1071,17 +1071,15 @@ std::unique_ptr<LocaleIface> GetLocaleFromBuffer(
if (src_span.empty())
return nullptr;
- uint8_t* pOut = nullptr;
+ std::unique_ptr<uint8_t, FxFreeDeleter> output;
uint32_t dwSize;
CCodec_ModuleMgr* pCodecMgr = CPDF_ModuleMgr::Get()->GetCodecModule();
pCodecMgr->GetFlateModule()->FlateOrLZWDecode(false, src_span, true, 0, 0, 0,
- 0, 0, &pOut, &dwSize);
- if (!pOut)
+ 0, 0, &output, &dwSize);
+ if (!output)
return nullptr;
- auto locale = CXFA_XMLLocale::Create(pdfium::make_span(pOut, dwSize));
- FX_Free(pOut);
- return locale;
+ return CXFA_XMLLocale::Create(pdfium::make_span(output.get(), dwSize));
}
uint16_t GetLanguage(WideString wsLanguage) {