gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated (dc7de219b -> 168e50199)


From: gnunet
Subject: [gnunet] branch master updated (dc7de219b -> 168e50199)
Date: Sat, 15 May 2021 18:48:59 +0200

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

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

    from dc7de219b -coverity: use after free
     new 60635a488 -coverity: properly handle return values
     new 168e50199 -coverity: use after free

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/datacache/plugin_datacache_sqlite.c  |  3 ++-
 src/datastore/datastore_api.c            |  2 +-
 src/datastore/gnunet-service-datastore.c |  6 ++++--
 src/datastore/plugin_datastore_sqlite.c  | 30 ++++++++++++++++++++++++++----
 4 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/src/datacache/plugin_datacache_sqlite.c 
b/src/datacache/plugin_datacache_sqlite.c
index a7da6b068..bade15479 100644
--- a/src/datacache/plugin_datacache_sqlite.c
+++ b/src/datacache/plugin_datacache_sqlite.c
@@ -764,7 +764,8 @@ libgnunet_plugin_datacache_sqlite_done (void *cls)
 #if ! WINDOWS || defined(__CYGWIN__)
   if ((NULL != plugin->fn) && (0 != unlink (plugin->fn)))
     LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "unlink", plugin->fn);
-  GNUNET_free (plugin->fn);
+  if (NULL != plugin->fn)
+    GNUNET_free (plugin->fn);
 #endif
   sqlite3_finalize (plugin->insert_stmt);
   sqlite3_finalize (plugin->get_count_stmt);
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c
index d658b9c85..cb21c9308 100644
--- a/src/datastore/datastore_api.c
+++ b/src/datastore/datastore_api.c
@@ -1430,7 +1430,7 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle 
*h,
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Could not queue request for `%s'\n",
-         GNUNET_h2s (key));
+         (NULL == key) ? "NULL" : GNUNET_h2s (key));
     return NULL;
   }
 #if INSANE_STATISTICS
diff --git a/src/datastore/gnunet-service-datastore.c 
b/src/datastore/gnunet-service-datastore.c
index 97888ce03..7d07ba3b3 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -1556,7 +1556,8 @@ run (void *cls,
                                            5);    /* approx. 3% false 
positives at max use */
       refresh_bf = GNUNET_YES;
     }
-    GNUNET_free (pfn);
+    if (NULL != pfn)
+      GNUNET_free (pfn);
   }
   else
   {
@@ -1566,7 +1567,8 @@ run (void *cls,
                                          5);  /* approx. 3% false positives at 
max use */
     refresh_bf = GNUNET_YES;
   }
-  GNUNET_free (fn);
+  if (NULL != fn)
+    GNUNET_free (fn);
   if (NULL == filter)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/datastore/plugin_datastore_sqlite.c 
b/src/datastore/plugin_datastore_sqlite.c
index cecc37978..40f955312 100644
--- a/src/datastore/plugin_datastore_sqlite.c
+++ b/src/datastore/plugin_datastore_sqlite.c
@@ -729,7 +729,8 @@ sqlite_plugin_put (void *cls,
   }
   GNUNET_SQ_reset (plugin->dbh, stmt);
   cont (cont_cls, key, size, ret, msg);
-  GNUNET_free (msg);
+  if (NULL != msg)
+    GNUNET_free (msg);
 }
 
 
@@ -1258,14 +1259,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]