From 60635a4887062fbcea6b5a8635a73bdadc20d5bc Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sat, 15 May 2021 18:40:31 +0200 Subject: -coverity: properly handle return values --- src/datastore/plugin_datastore_sqlite.c | 27 ++++++++++++++++++++++++--- 1 file 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 ( -- cgit v1.2.3