diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 17:08:46 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 17:08:46 +0000 |
commit | fcc681407908a0f160a4861fe046dc02fb80a3e3 (patch) | |
tree | 56e88a00acc5ed78a098035f9c9d086f1d5a7d5f /net | |
parent | 28ad92a4ab702510bc6287f407548d8b6e3a1cd5 (diff) | |
download | chromium_src-fcc681407908a0f160a4861fe046dc02fb80a3e3.zip chromium_src-fcc681407908a0f160a4861fe046dc02fb80a3e3.tar.gz chromium_src-fcc681407908a0f160a4861fe046dc02fb80a3e3.tar.bz2 |
Coverity: Fix leaking UCharsetDetector in ftp code.
CID=7193
BUG=none
TEST=using the additional test data, tools/valgrind/chrome_tests.sh -t net --gtest_filter="FtpDirectoryListingBufferTest.*"
Review URL: http://codereview.chromium.org/355037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/data/ftp/dir-listing-ls-1-utf8 | 6 | ||||
-rw-r--r-- | net/data/ftp/dir-listing-ls-1-utf8.expected | 53 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_buffer.cc | 1 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_buffer_unittest.cc | 1 |
4 files changed, 61 insertions, 0 deletions
diff --git a/net/data/ftp/dir-listing-ls-1-utf8 b/net/data/ftp/dir-listing-ls-1-utf8 new file mode 100644 index 0000000..8f33030 --- /dev/null +++ b/net/data/ftp/dir-listing-ls-1-utf8 @@ -0,0 +1,6 @@ +drwxr-xr-x 3 ftp ftp 4096 May 15 18:11 .
+drwxr-xr-x 3 ftp ftp 4096 May 15 18:11 ..
+-rw-r--r-- 1 ftp ftp 528 Nov 01 2007 .message
+-rw-r--r-- 1 ftp ftp 528 Nov 01 2007 README!
+-rw-r--r-- 1 ftp ftp 560 Sep 28 2007 こんにちは.html
+drwxr-xr-x 33 ftp ftp 4096 Aug 12 2008 pub
diff --git a/net/data/ftp/dir-listing-ls-1-utf8.expected b/net/data/ftp/dir-listing-ls-1-utf8.expected new file mode 100644 index 0000000..bdb02ba --- /dev/null +++ b/net/data/ftp/dir-listing-ls-1-utf8.expected @@ -0,0 +1,53 @@ +d +. +-1 +current +5 +15 +18 +11 + +d +.. +-1 +current +5 +15 +18 +11 + +- +.message +528 +2007 +11 +1 +0 +0 + +- +README! +528 +2007 +11 +1 +0 +0 + +- +こんにちは.html +560 +2007 +9 +28 +0 +0 + +d +pub +-1 +2008 +8 +12 +0 +0 diff --git a/net/ftp/ftp_directory_listing_buffer.cc b/net/ftp/ftp_directory_listing_buffer.cc index 030da83..d7833e8 100644 --- a/net/ftp/ftp_directory_listing_buffer.cc +++ b/net/ftp/ftp_directory_listing_buffer.cc @@ -27,6 +27,7 @@ std::string DetectEncoding(const std::string& text) { &status); const UCharsetMatch* match = ucsdet_detect(detector, &status); const char* encoding = ucsdet_getName(match, &status); + ucsdet_close(detector); // Should we check the quality of the match? A rather arbitrary number is // assigned by ICU and it's hard to come up with a lower limit. if (U_FAILURE(status)) diff --git a/net/ftp/ftp_directory_listing_buffer_unittest.cc b/net/ftp/ftp_directory_listing_buffer_unittest.cc index f8f1a51..ae448fb 100644 --- a/net/ftp/ftp_directory_listing_buffer_unittest.cc +++ b/net/ftp/ftp_directory_listing_buffer_unittest.cc @@ -17,6 +17,7 @@ namespace { TEST(FtpDirectoryListingBufferTest, Parse) { const char* test_files[] = { "dir-listing-ls-1", + "dir-listing-ls-1-utf8", "dir-listing-ls-2", "dir-listing-vms-1", "dir-listing-vms-2", |