summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-05-15 16:10:35 -0700
committerLei Zhang <thestig@chromium.org>2015-05-15 16:10:35 -0700
commit917c7fa7ccb5b7d5a9d89e717357f0ac6dfb9aa9 (patch)
treefb946ea11255b12080dc642d6162ebbfe5a95847 /core/src/fpdfapi
parent490842eac38daebf5e49e3ae6aef601a00c73dce (diff)
downloadpdfium-917c7fa7ccb5b7d5a9d89e717357f0ac6dfb9aa9.tar.xz
Merge to XFA: 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 (cherry picked from commit 1962d61b28df03284e3e5c6de6a19f397a066e68) Review URL: https://codereview.chromium.org/1125413008
Diffstat (limited to 'core/src/fpdfapi')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp8
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);
}
}