gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 01/02: -coverity: properly handle return values


From: gnunet
Subject: [gnunet] 01/02: -coverity: properly handle return values
Date: Sat, 15 May 2021 18:49:00 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

commit 60635a4887062fbcea6b5a8635a73bdadc20d5bc
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Sat May 15 18:40:31 2021 +0200

    -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 (

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]