summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_attachment.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-09-11 07:57:48 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-11 07:57:48 +0000
commit8365e76fe8a311eaf77c4b5d5c0b199de0238f07 (patch)
treec30b4fc3079c254432e120d211933ba89c80f69e /fpdfsdk/fpdf_attachment.cpp
parent8550a2d1e037ef444e8ac340ea70001c7a25091c (diff)
downloadpdfium-8365e76fe8a311eaf77c4b5d5c0b199de0238f07.tar.xz
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 <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_attachment.cpp')
-rw-r--r--fpdfsdk/fpdf_attachment.cpp6
1 files changed, 2 insertions, 4 deletions
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<uint8_t, FxFreeDeleter> 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) {