diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-16 21:26:53 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-16 21:26:53 +0000 |
commit | 24d4394e6224a8fd713011661377192d527bd8a2 (patch) | |
tree | fa4d31348b7acff58118cd68015d4cd8cb8d7efb /ppapi | |
parent | 7b35be2ef7cdf7f52805f70464a269d8ac995385 (diff) | |
download | chromium_src-24d4394e6224a8fd713011661377192d527bd8a2.zip chromium_src-24d4394e6224a8fd713011661377192d527bd8a2.tar.gz chromium_src-24d4394e6224a8fd713011661377192d527bd8a2.tar.bz2 |
ppapi: Fix memory leaks in TestCharSetToUTF16.
BUG=90644
TEST=none
R=brettw@chromium.org
Review URL: http://codereview.chromium.org/8486018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110351 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/tests/test_char_set.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ppapi/tests/test_char_set.cc b/ppapi/tests/test_char_set.cc index 05e32c9..868c350 100644 --- a/ppapi/tests/test_char_set.cc +++ b/ppapi/tests/test_char_set.cc @@ -103,6 +103,8 @@ std::string TestCharSet::TestUTF16ToCharSet() { } std::string TestCharSet::TestCharSetToUTF16() { + pp::Memory_Dev memory; + // Empty string. uint32_t utf16result_len; uint16_t* utf16result = char_set_interface_->CharSetToUTF16( @@ -111,6 +113,7 @@ std::string TestCharSet::TestCharSetToUTF16() { ASSERT_TRUE(utf16result); ASSERT_TRUE(utf16result_len == 0); ASSERT_TRUE(utf16result[0] == 0); + memory.MemFree(utf16result); // Basic Latin1. char latin1[] = "H\xef"; @@ -121,6 +124,7 @@ std::string TestCharSet::TestCharSetToUTF16() { ASSERT_TRUE(utf16result_len == 2); ASSERT_TRUE(utf16result[0] == 'H' && utf16result[1] == 0xef && utf16result[2] == 0); + memory.MemFree(utf16result); // Invalid input encoding with FAIL. char badutf8[] = "A\xe4Z"; @@ -129,6 +133,7 @@ std::string TestCharSet::TestCharSetToUTF16() { PP_CHARSET_CONVERSIONERROR_FAIL, &utf16result_len); ASSERT_TRUE(!utf16result); ASSERT_TRUE(utf16result_len == 0); + memory.MemFree(utf16result); // Invalid input with SKIP. utf16result = char_set_interface_->CharSetToUTF16( @@ -138,6 +143,7 @@ std::string TestCharSet::TestCharSetToUTF16() { ASSERT_TRUE(utf16result_len == 2); ASSERT_TRUE(utf16result[0] == 'A' && utf16result[1] == 'Z' && utf16result[2] == 0); + memory.MemFree(utf16result); // Invalid input with SUBSTITUTE. utf16result = char_set_interface_->CharSetToUTF16( @@ -147,6 +153,7 @@ std::string TestCharSet::TestCharSetToUTF16() { ASSERT_TRUE(utf16result_len == 3); ASSERT_TRUE(utf16result[0] == 'A' && utf16result[1] == 0xFFFD && utf16result[2] == 'Z' && utf16result[3] == 0); + memory.MemFree(utf16result); // Invalid encoding name. utf16result = char_set_interface_->CharSetToUTF16( @@ -154,6 +161,7 @@ std::string TestCharSet::TestCharSetToUTF16() { PP_CHARSET_CONVERSIONERROR_SUBSTITUTE, &utf16result_len); ASSERT_TRUE(!utf16result); ASSERT_TRUE(utf16result_len == 0); + memory.MemFree(utf16result); PASS(); } |