diff options
author | Lei Zhang <thestig@chromium.org> | 2018-10-15 16:56:47 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-15 16:56:47 +0000 |
commit | 7c39bf7b87f871ccc50b66066c3bfb1883f66010 (patch) | |
tree | 57f56441c6e7b136ee0418fcb2dc53d866a780c0 /core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp | |
parent | 4f5ccaaecd7e524e98b79af6823a9ab6a8753d7f (diff) | |
download | pdfium-7c39bf7b87f871ccc50b66066c3bfb1883f66010.tar.xz |
Make FlateEncode()'s buffer out parameter a unique_ptr.
Change-Id: I31a5abb3c8dd31826098493f51effbd5afe109d1
Reviewed-on: https://pdfium-review.googlesource.com/c/41856
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp')
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp index 94776e17ea..4c99394221 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode_embeddertest.cpp @@ -37,16 +37,15 @@ TEST_F(FPDFParserDecodeEmbeddertest, FlateEncode) { for (size_t i = 0; i < FX_ArraySize(flate_encode_cases); ++i) { const pdfium::StrFuncTestData& data = flate_encode_cases[i]; - unsigned char* buf = nullptr; + std::unique_ptr<uint8_t, FxFreeDeleter> buf; uint32_t buf_size; EXPECT_TRUE(FlateEncode({data.input, data.input_size}, &buf, &buf_size)); ASSERT_TRUE(buf); EXPECT_EQ(data.expected_size, buf_size) << " for case " << i; if (data.expected_size != buf_size) continue; - EXPECT_EQ(0, memcmp(data.expected, buf, data.expected_size)) + EXPECT_EQ(0, memcmp(data.expected, buf.get(), data.expected_size)) << " for case " << i; - FX_Free(buf); } } |