aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/sqlite
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-04-11 22:18:44 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-04-11 22:18:44 +0200
commit180dc85b29e95605c203917097d15d00be88ffdb (patch)
treef1a666d6896517d07ce361506cfba8b8cc8c1b70 /src/sqlite
parentput SQL headers to a separate directory (diff)
downloadcimple-180dc85b29e95605c203917097d15d00be88ffdb.tar.gz
cimple-180dc85b29e95605c203917097d15d00be88ffdb.zip
sqlite: fix error handling
Diffstat (limited to '')
-rw-r--r--src/sqlite.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/sqlite.c b/src/sqlite.c
index 168ab9a..0c58b0e 100644
--- a/src/sqlite.c
+++ b/src/sqlite.c
@@ -228,7 +228,7 @@ free:
return ret;
}
-int sqlite_get_user_version(sqlite3 *db, unsigned int *version)
+int sqlite_get_user_version(sqlite3 *db, unsigned int *output)
{
sqlite3_stmt *stmt;
int result, ret = 0;
@@ -243,9 +243,10 @@ int sqlite_get_user_version(sqlite3 *db, unsigned int *version)
result = sqlite_column_int(stmt, 0);
if (result < 0) {
log_err("Invalid database version: %d\n", result);
- return -1;
+ ret = -1;
+ goto finalize;
}
- *version = (unsigned int)result;
+ *output = (unsigned int)result;
goto finalize;