diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-04-11 22:18:44 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-04-11 22:18:44 +0200 |
commit | 180dc85b29e95605c203917097d15d00be88ffdb (patch) | |
tree | f1a666d6896517d07ce361506cfba8b8cc8c1b70 /src/sqlite | |
parent | put SQL headers to a separate directory (diff) | |
download | cimple-180dc85b29e95605c203917097d15d00be88ffdb.tar.gz cimple-180dc85b29e95605c203917097d15d00be88ffdb.zip |
sqlite: fix error handling
Diffstat (limited to '')
-rw-r--r-- | src/sqlite.c | 7 |
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; |