summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2021-05-15 18:40:31 +0200
committerMartin Schanzenbach <mschanzenbach@posteo.de>2021-05-15 18:40:31 +0200
commit60635a4887062fbcea6b5a8635a73bdadc20d5bc (patch)
treef518eaea582eb76de1b10bc21e9b28a12fda936f
parentdc7de219b5a16dc63e7492981d5d7fcd79d91fc8 (diff)
-coverity: properly handle return values
-rw-r--r--src/datastore/plugin_datastore_sqlite.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c
index cecc37978..f58955b7b 100644
--- a/src/datastore/plugin_datastore_sqlite.c
+++ b/src/datastore/plugin_datastore_sqlite.c
@@ -1258,14 +1258,35 @@ sqlite_plugin_estimate_size (void *cls, unsigned long long *estimate)
NULL,
NULL,
ENULL));
- CHECK (SQLITE_OK == sq_prepare (plugin->dbh, "PRAGMA page_count", &stmt));
+ if (SQLITE_OK != sq_prepare (plugin->dbh, "PRAGMA page_count", &stmt))
+ {
+ GNUNET_log_from (
+ GNUNET_ERROR_TYPE_WARNING,
+ "datastore-sqlite",
+ _("error preparing statement\n"));
+ return;
+ }
if (SQLITE_ROW == sqlite3_step (stmt))
pages = sqlite3_column_int64 (stmt, 0);
else
pages = 0;
sqlite3_finalize (stmt);
- CHECK (SQLITE_OK == sq_prepare (plugin->dbh, "PRAGMA page_size", &stmt));
- CHECK (SQLITE_ROW == sqlite3_step (stmt));
+ if (SQLITE_OK != sq_prepare (plugin->dbh, "PRAGMA page_size", &stmt))
+ {
+ GNUNET_log_from (
+ GNUNET_ERROR_TYPE_WARNING,
+ "datastore-sqlite",
+ _("error preparing statement\n"));
+ return;
+ }
+ if (SQLITE_ROW != sqlite3_step (stmt))
+ {
+ GNUNET_log_from (
+ GNUNET_ERROR_TYPE_WARNING,
+ "datastore-sqlite",
+ _("error stepping\n"));
+ return;
+ }
page_size = sqlite3_column_int64 (stmt, 0);
sqlite3_finalize (stmt);
GNUNET_log (