aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Kaijser <martijn@xbmc.org>2017-05-24 22:46:16 +0200
committerGitHub <noreply@github.com>2017-05-24 22:46:16 +0200
commitdcd68cf10940e30e20765008c932d0af8f474990 (patch)
tree9869ae91844c35bb25191f7245a36dce83446c73
parente4a88ae1fec514f74cf3d12208669b366c5df1b3 (diff)
parent33e8935928d24755a7e646cfe0fd4b63f94b23d9 (diff)
Merge pull request #12156 from MilhouseVH/close_before_rm_krypton
sqlite: Close file before attempting deletion
-rw-r--r--xbmc/dbwrappers/sqlitedataset.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/xbmc/dbwrappers/sqlitedataset.cpp b/xbmc/dbwrappers/sqlitedataset.cpp
index d3764a776f..c9141e4725 100644
--- a/xbmc/dbwrappers/sqlitedataset.cpp
+++ b/xbmc/dbwrappers/sqlitedataset.cpp
@@ -232,10 +232,12 @@ int SqliteDatabase::connect(bool create) {
{
if (file.GetLength() == 0)
{
+ file.Close();
CLog::Log(LOGWARNING, "Found zero byte SQLite database, deleting %s", db_fullpath.c_str());
CFile::Delete(db_fullpath.c_str());
}
- file.Close();
+ else
+ file.Close();
}
}