diff options
author | sra@chromium.org <sra@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-30 00:47:49 +0000 |
---|---|---|
committer | sra@chromium.org <sra@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-30 00:47:49 +0000 |
commit | 70d56be631ab6616cd7661468df6ba91c5821193 (patch) | |
tree | 665b7bf1850c14bf0f0eb5148dc4557f159f6687 /courgette | |
parent | 1869411883c8ac422315fa702e3403df95bb0a3f (diff) | |
download | chromium_src-70d56be631ab6616cd7661468df6ba91c5821193.zip chromium_src-70d56be631ab6616cd7661468df6ba91c5821193.tar.gz chromium_src-70d56be631ab6616cd7661468df6ba91c5821193.tar.bz2 |
Fix leaks found by Coverity Prevent.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/115947
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17272 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette')
-rw-r--r-- | courgette/courgette_tool.cc | 2 | ||||
-rw-r--r-- | courgette/image_info_unittest.cc | 15 |
2 files changed, 9 insertions, 8 deletions
diff --git a/courgette/courgette_tool.cc b/courgette/courgette_tool.cc index c07f2da..96a5af4 100644 --- a/courgette/courgette_tool.cc +++ b/courgette/courgette_tool.cc @@ -207,7 +207,7 @@ void DisassembleAdjustDiff(const std::wstring& model_file, courgette::WriteEncodedProgram(encoded_model, &model_sinks); if (write_model_status != courgette::C_OK) Problem("Can't serialize encoded model."); - courgette::DeleteEncodedProgram(encoded_program); + courgette::DeleteEncodedProgram(encoded_model); for (int i = 0; ; ++i) { courgette::SinkStream* old_stream = model_sinks.stream(i); diff --git a/courgette/image_info_unittest.cc b/courgette/image_info_unittest.cc index 6d6deb5..bf0ca6e 100644 --- a/courgette/image_info_unittest.cc +++ b/courgette/image_info_unittest.cc @@ -8,6 +8,7 @@ #include "base/path_service.h" #include "base/file_util.h" +#include "base/scoped_ptr.h" #include "base/string_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -27,15 +28,15 @@ class ImageInfoTest : public testing::Test { void TearDown() { } - void ExpectExecutable(courgette::PEInfo *info) const; + void ExpectExecutable(courgette::PEInfo* info) const; - std::string FileContents(const char *file_name) const; + std::string FileContents(const char* file_name) const; std::wstring test_dir_; }; // Reads a test file into a string. -std::string ImageInfoTest::FileContents(const char *file_name) const { +std::string ImageInfoTest::FileContents(const char* file_name) const { std::wstring file_path = test_dir_; file_util::AppendToPath(&file_path, UTF8ToWide(file_name)); std::string file_bytes; @@ -45,7 +46,7 @@ std::string ImageInfoTest::FileContents(const char *file_name) const { return file_bytes; } -void ImageInfoTest::ExpectExecutable(courgette::PEInfo *info) const { +void ImageInfoTest::ExpectExecutable(courgette::PEInfo* info) const { EXPECT_TRUE(info->ok()); EXPECT_TRUE(info->has_text_section()); } @@ -53,7 +54,7 @@ void ImageInfoTest::ExpectExecutable(courgette::PEInfo *info) const { void ImageInfoTest::TestExe() const { std::string file1 = FileContents("setup1.exe"); - courgette::PEInfo *info = new courgette::PEInfo(); + scoped_ptr<courgette::PEInfo> info(new courgette::PEInfo()); info->Init(reinterpret_cast<const uint8*>(file1.c_str()), file1.length()); bool can_parse_header = info->ParseHeader(); @@ -62,7 +63,7 @@ void ImageInfoTest::TestExe() const { // The executable is the whole file, not 'embedded' with the file EXPECT_EQ(file1.length(), info->length()); - ExpectExecutable(info); + ExpectExecutable(info.get()); EXPECT_EQ(449536, info->size_of_code()); EXPECT_EQ(SectionName(info->RVAToSection(0x00401234 - 0x00400000)), std::string(".text")); @@ -85,7 +86,7 @@ void ImageInfoTest::TestExe() const { void ImageInfoTest::TestResourceDll() const { std::string file1 = FileContents("en-US.dll"); - courgette::PEInfo *info = new courgette::PEInfo(); + scoped_ptr<courgette::PEInfo> info(new courgette::PEInfo()); info->Init(reinterpret_cast<const uint8*>(file1.c_str()), file1.length()); bool can_parse_header = info->ParseHeader(); |