diff options
author | Lei Zhang <thestig@chromium.org> | 2015-05-15 16:09:12 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-05-15 16:09:12 -0700 |
commit | 1962d61b28df03284e3e5c6de6a19f397a066e68 (patch) | |
tree | 02cfd552f1f18a1377ab5b804e91d252199f3c8a /core/src/fpdfapi | |
parent | 69b4bc7278d9c2b7ab1564aca20795f02393357a (diff) | |
download | pdfium-1962d61b28df03284e3e5c6de6a19f397a066e68.tar.xz |
Fix leaks in embedder test's FlateEncode() usage and in FlateEncode().
For FlateEncode(), error handling code leaked memory.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1144603002
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp index 45caf4e9be..6f97c08d2d 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp @@ -50,10 +50,12 @@ TEST_F(FPDFParserDecodeEmbeddertest, FlateEncode) { FlateEncodeCase* ptr = &flate_encode_cases[i]; unsigned char* result; unsigned int result_size; - FlateEncode(ptr->input, ptr->input_size, result, result_size); // Leaks. + FlateEncode(ptr->input, ptr->input_size, result, result_size); + ASSERT_TRUE(result); EXPECT_EQ(std::string((const char*)ptr->expected, ptr->expected_size), std::string((const char*)result, result_size)) << " for case " << i; + FX_Free(result); } } @@ -87,10 +89,12 @@ TEST_F(FPDFParserDecodeEmbeddertest, FlateDecode) { FlateDecodeCase* ptr = &flate_decode_cases[i]; unsigned char* result; unsigned int result_size; - FlateDecode(ptr->input, ptr->input_size, result, result_size); // Leaks. + FlateDecode(ptr->input, ptr->input_size, result, result_size); + ASSERT_TRUE(result); EXPECT_EQ(std::string((const char*)ptr->expected, ptr->expected_size), std::string((const char*)result, result_size)) << " for case " << i; + FX_Free(result); } } |