From 8365e76fe8a311eaf77c4b5d5c0b199de0238f07 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 11 Sep 2018 07:57:48 +0000 Subject: Make HexDecode()'s buffer out parameter a unique_ptr. Do the same for A85Decode(). Change-Id: Ic6a0e5e8a63defa104e35e97eb9ce4223aac23a7 Reviewed-on: https://pdfium-review.googlesource.com/41851 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- fpdfsdk/fpdf_attachment.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdf_attachment.cpp b/fpdfsdk/fpdf_attachment.cpp index f3c1c83cf9..7bc168025a 100644 --- a/fpdfsdk/fpdf_attachment.cpp +++ b/fpdfsdk/fpdf_attachment.cpp @@ -27,12 +27,10 @@ namespace { constexpr char kChecksumKey[] = "CheckSum"; ByteString CFXByteStringHexDecode(const ByteString& bsHex) { - uint8_t* result = nullptr; + std::unique_ptr result; uint32_t size = 0; HexDecode(bsHex.AsRawSpan(), &result, &size); - ByteString bsDecoded(result, size); - FX_Free(result); - return bsDecoded; + return ByteString(result.get(), size); } ByteString GenerateMD5Base16(const void* contents, const unsigned long len) { -- cgit v1.2.3