diff options
author | benm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-10 20:02:29 +0000 |
---|---|---|
committer | benm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-10 20:02:29 +0000 |
commit | 64021049338a2785682dec1a9222fb027c5b0852 (patch) | |
tree | 8d596642a41e5fd345abc8d28bbc814edf1ee2d2 /sql/connection.cc | |
parent | 0ff31a24502a793f7d29d4121c7e4a6fd70ce98c (diff) | |
download | chromium_src-64021049338a2785682dec1a9222fb027c5b0852.zip chromium_src-64021049338a2785682dec1a9222fb027c5b0852.tar.gz chromium_src-64021049338a2785682dec1a9222fb027c5b0852.tar.bz2 |
Fix leak inside sql::Connection::OpenInternal.
Make sure to close the database even if we failed to open it.
BUG=113658
Review URL: http://codereview.chromium.org/9381011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121501 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sql/connection.cc')
-rw-r--r-- | sql/connection.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/connection.cc b/sql/connection.cc index 38fd62a..bebf68a 100644 --- a/sql/connection.cc +++ b/sql/connection.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -367,6 +367,7 @@ bool Connection::OpenInternal(const std::string& file_name) { int err = sqlite3_open(file_name.c_str(), &db_); if (err != SQLITE_OK) { OnSqliteError(err, NULL); + Close(); db_ = NULL; return false; } |