diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 02:05:14 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 02:05:14 +0000 |
commit | 0dfbe224f42d7a56697297b515708037add24da1 (patch) | |
tree | c99bbf7b5dd962914b335ad24e5597cfe0419293 /chrome/browser/sessions/session_backend.cc | |
parent | 018305930db3869912ee7bd41214a04c87b0874a (diff) | |
download | chromium_src-0dfbe224f42d7a56697297b515708037add24da1.zip chromium_src-0dfbe224f42d7a56697297b515708037add24da1.tar.gz chromium_src-0dfbe224f42d7a56697297b515708037add24da1.tar.bz2 |
Coverity: Fix leak in SessionBackend::OpenAndWriteHeader on error conditions.
CID=9159
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2924014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52420 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sessions/session_backend.cc')
-rw-r--r-- | chrome/browser/sessions/session_backend.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/chrome/browser/sessions/session_backend.cc b/chrome/browser/sessions/session_backend.cc index dfb1200..c06f811 100644 --- a/chrome/browser/sessions/session_backend.cc +++ b/chrome/browser/sessions/session_backend.cc @@ -352,7 +352,7 @@ void SessionBackend::ResetFile() { net::FileStream* SessionBackend::OpenAndWriteHeader(const FilePath& path) { DCHECK(!path.empty()); - net::FileStream* file = new net::FileStream(); + scoped_ptr<net::FileStream> file(new net::FileStream()); file->Open(path, base::PLATFORM_FILE_CREATE_ALWAYS | base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_WRITE | base::PLATFORM_FILE_EXCLUSIVE_READ); @@ -365,7 +365,7 @@ net::FileStream* SessionBackend::OpenAndWriteHeader(const FilePath& path) { sizeof(header), NULL); if (wrote != sizeof_header()) return NULL; - return file; + return file.release(); } FilePath SessionBackend::GetLastSessionPath() { |