From 180dc85b29e95605c203917097d15d00be88ffdb Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 11 Apr 2023 22:18:44 +0200 Subject: sqlite: fix error handling --- src/sqlite.c | 7 ++++--- 1 file 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; -- cgit v1.2.3