From 7dc8165b9b94b23cbb5bf23977d1cd7523ecb16e Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sat, 15 May 2021 19:46:29 +0200 Subject: Revert "-coverity: use after free" This reverts commit 168e501991b9506b588e1180527dad9c9662ae0c. --- 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 | 3 +-- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c index bade15479..a7da6b068 100644 --- a/src/datacache/plugin_datacache_sqlite.c +++ b/src/datacache/plugin_datacache_sqlite.c @@ -764,8 +764,7 @@ 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); - if (NULL != plugin->fn) - GNUNET_free (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 cb21c9308..d658b9c85 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", - (NULL == key) ? "NULL" : GNUNET_h2s (key)); + 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 7d07ba3b3..97888ce03 100644 --- a/src/datastore/gnunet-service-datastore.c +++ b/src/datastore/gnunet-service-datastore.c @@ -1556,8 +1556,7 @@ run (void *cls, 5); /* approx. 3% false positives at max use */ refresh_bf = GNUNET_YES; } - if (NULL != pfn) - GNUNET_free (pfn); + GNUNET_free (pfn); } else { @@ -1567,8 +1566,7 @@ run (void *cls, 5); /* approx. 3% false positives at max use */ refresh_bf = GNUNET_YES; } - if (NULL != fn) - GNUNET_free (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 40f955312..f58955b7b 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c @@ -729,8 +729,7 @@ sqlite_plugin_put (void *cls, } GNUNET_SQ_reset (plugin->dbh, stmt); cont (cont_cls, key, size, ret, msg); - if (NULL != msg) - GNUNET_free (msg); + GNUNET_free (msg); } -- cgit v1.2.3