Check return value and log an error on failure (#13037)
Stelios Fragkakis committed
May 30, 2022 at 22:39 UTC
7e01ad1192fe43597d507a1c81aab94f5963e61a
1 file changed
+6
-2
database/sqlite/sqlite_functions.c
+6
-2
@@ -94,8 +94,12 @@ static void add_stmt_to_list(sqlite3_stmt *res)
94
static sqlite3_stmt *statements[MAX_OPEN_STATEMENTS];
95
96
if (unlikely(!res)) {
97
- while (idx > 0)
98
- sqlite3_finalize(statements[--idx]);
97
+ while (idx > 0) {
98
+ int rc;
99
+ rc = sqlite3_finalize(statements[--idx]);
100
+ if (unlikely(rc != SQLITE_OK))
101
+ error_report("Failed to finalize statement during shutdown, rc = %d", rc);
102
+ }
103
return;
104
}
105