Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp

Issue 1144603002: Fix leaks in embedder test's FlateEncode() usage and in FlateEncode(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/src/fxcodec/codec/fx_codec_flate.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp
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 45caf4e9beb4c1b79b2991f93393a2e09b6b6d26..6f97c08d2d63830ddab8ccee4c2b99956a40c20a 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);
}
}
« no previous file with comments | « no previous file | core/src/fxcodec/codec/fx_codec_flate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698