aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-10-08 12:26:49 +0200
committerChristian Grothoff <christian@grothoff.org>2024-10-08 12:26:49 +0200
commit5388a30a7c783196e06ae646a9f6fc07dfabb1b0 (patch)
tree3e6a5dc0bffa9762b91c2f07e6d3ca89631f43b8
parent40dc7814728d7d142d18bce93434523d584b3e9d (diff)
fix more compiler warnings and memory leaks
-rw-r--r--src/auditor/report-lib.c8
-rw-r--r--src/auditor/report-lib.h4
-rw-r--r--src/auditor/taler-auditor-httpd_coin-inconsistency-get.c36
-rw-r--r--src/auditor/taler-auditor-httpd_delete_generic.c121
-rw-r--r--src/auditor/taler-auditor-httpd_patch_generic_suppressed.c3
-rw-r--r--src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c61
-rw-r--r--src/auditor/taler-auditor-httpd_row-inconsistency-get.c33
-rw-r--r--src/auditor/taler-helper-auditor-coins.c10
-rw-r--r--src/auditor/taler-helper-auditor-deposits.c2
9 files changed, 125 insertions, 153 deletions
diff --git a/src/auditor/report-lib.c b/src/auditor/report-lib.c
index 2bbdf569d..3ca2912a7 100644
--- a/src/auditor/report-lib.c
+++ b/src/auditor/report-lib.c
@@ -133,7 +133,7 @@ add_denomination (
enum GNUNET_DB_QueryStatus
TALER_ARL_get_denomination_info_by_hash (
const struct TALER_DenominationHashP *dh,
- const struct TALER_EXCHANGEDB_DenominationKeyInformation **issue)
+ const struct TALER_EXCHANGEDB_DenominationKeyInformation **issuep)
{
enum GNUNET_DB_QueryStatus qs;
@@ -147,7 +147,7 @@ TALER_ARL_get_denomination_info_by_hash (
if (0 > qs)
{
GNUNET_break (0);
- *issue = NULL;
+ *issuep = NULL;
return qs;
}
}
@@ -159,7 +159,7 @@ TALER_ARL_get_denomination_info_by_hash (
if (NULL != i)
{
/* cache hit */
- *issue = i;
+ *issuep = i;
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
}
}
@@ -191,7 +191,7 @@ TALER_ARL_get_denomination_info_by_hash (
if (NULL != i)
{
/* cache hit */
- *issue = i;
+ *issuep = i;
return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
}
}
diff --git a/src/auditor/report-lib.h b/src/auditor/report-lib.h
index bf2d63740..369ac3ccf 100644
--- a/src/auditor/report-lib.h
+++ b/src/auditor/report-lib.h
@@ -135,14 +135,14 @@ extern struct GNUNET_TIME_Absolute start_time;
* Obtain information about a @a denom_pub.
*
* @param dh hash of the denomination public key to look up
- * @param[out] issue set to detailed information about @a denom_pub, NULL if not found, must
+ * @param[out] issuep set to detailed information about @a denom_pub, NULL if not found, must
* NOT be freed by caller
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
TALER_ARL_get_denomination_info_by_hash (
const struct TALER_DenominationHashP *dh,
- const struct TALER_EXCHANGEDB_DenominationKeyInformation **issue);
+ const struct TALER_EXCHANGEDB_DenominationKeyInformation **issuep);
/**
diff --git a/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c b/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c
index 1d96e2340..f5eb28ac0 100644
--- a/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c
+++ b/src/auditor/taler-auditor-httpd_coin-inconsistency-get.c
@@ -13,8 +13,6 @@
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-
-
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_json_lib.h>
@@ -24,9 +22,9 @@
#include "taler_json_lib.h"
#include "taler_mhd_lib.h"
#include "taler-auditor-httpd.h"
-
#include "taler-auditor-httpd_coin-inconsistency-get.h"
+
/**
* Add deposit confirmation to the list.
*
@@ -51,12 +49,9 @@ add_coin_inconsistency (
GNUNET_JSON_pack_data_auto ("coin_pub",&dc->coin_pub),
GNUNET_JSON_pack_bool ("profitable", dc->profitable)
);
-
GNUNET_break (0 ==
json_array_append_new (list,
obj));
-
-
return GNUNET_OK;
}
@@ -72,6 +67,9 @@ TAH_COIN_INCONSISTENCY_handler_get (
{
json_t *ja;
enum GNUNET_DB_QueryStatus qs;
+ int64_t limit = -20;
+ uint64_t offset;
+ bool return_suppressed = false;
if (GNUNET_SYSERR ==
TAH_plugin->preflight (TAH_plugin->cls))
@@ -82,34 +80,27 @@ TAH_COIN_INCONSISTENCY_handler_get (
TALER_EC_GENERIC_DB_SETUP_FAILED,
NULL);
}
- ja = json_array ();
- GNUNET_break (NULL != ja);
-
- int64_t limit = -20;
- uint64_t offset;
-
TALER_MHD_parse_request_snumber (connection,
"limit",
&limit);
-
if (limit < 0)
offset = INT64_MAX;
else
offset = 0;
-
TALER_MHD_parse_request_number (connection,
"offset",
&offset);
-
- bool return_suppressed = false;
- const char *ret_s = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
- if (ret_s != NULL && strcmp (ret_s, "true") == 0)
{
- return_suppressed = true;
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if (ret_s != NULL && strcmp (ret_s, "true") == 0)
+ {
+ return_suppressed = true;
+ }
}
-
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
qs = TAH_plugin->get_coin_inconsistency (
TAH_plugin->cls,
limit,
@@ -117,7 +108,6 @@ TAH_COIN_INCONSISTENCY_handler_get (
return_suppressed,
&add_coin_inconsistency,
ja);
-
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
diff --git a/src/auditor/taler-auditor-httpd_delete_generic.c b/src/auditor/taler-auditor-httpd_delete_generic.c
index 2f2775cd1..f435454fe 100644
--- a/src/auditor/taler-auditor-httpd_delete_generic.c
+++ b/src/auditor/taler-auditor-httpd_delete_generic.c
@@ -13,8 +13,6 @@
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-
-
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_json_lib.h>
@@ -24,6 +22,7 @@
#include "taler_json_lib.h"
#include "taler_mhd_lib.h"
#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_delete_generic.h"
MHD_RESULT
@@ -33,64 +32,66 @@ TAH_delete_handler_generic (
void **connection_cls,
const char *upload_data,
size_t *upload_data_size,
- const char *const args[]) {
- enum GNUNET_DB_QueryStatus qs;
- unsigned long long row_id;
-
- (void) connection_cls;
- if (GNUNET_SYSERR ==
- TAH_plugin->preflight(TAH_plugin->cls)) {
- GNUNET_break(0);
- return TALER_MHD_reply_with_error(connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_SETUP_FAILED,
- NULL);
- }
-
- if ((NULL == args[1]) ||
- (1 != sscanf(args[1],
- "%llu",
- &row_id))) {
- GNUNET_break_op(0);
- return TALER_MHD_reply_with_error(connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_AUDITOR_RESOURCE_NOT_FOUND,
- "no row id specified");
- }
+ const char *const args[])
+{
+ enum GNUNET_DB_QueryStatus qs;
+ unsigned long long row_id;
+ char dummy;
- {
+ (void) connection_cls;
+ if (GNUNET_SYSERR ==
+ TAH_plugin->preflight (TAH_plugin->cls))
+ {
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_SETUP_FAILED,
+ NULL);
+ }
- /* execute transaction */
- qs = TAH_plugin->delete_generic(TAH_plugin->cls,
- rh->table,
- row_id);
+ if ((NULL == args[1]) ||
+ (1 != sscanf (args[1],
+ "%llu%c",
+ &row_id,
+ &dummy)))
+ {
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_AUDITOR_RESOURCE_NOT_FOUND,
+ "no row id specified");
+ }
- switch (qs) {
- case GNUNET_DB_STATUS_HARD_ERROR:
- GNUNET_break(0);
- return TALER_MHD_reply_with_error(connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_STORE_FAILED,
- "db store failed");
- case GNUNET_DB_STATUS_SOFT_ERROR:
- GNUNET_break(0);
- return TALER_MHD_reply_with_error(connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
- "unexpected serialization problem");
- case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
- return TALER_MHD_reply_with_error(connection,
- MHD_HTTP_NOT_FOUND,
- TALER_EC_AUDITOR_RESOURCE_NOT_FOUND,
- "no delete executed");
- case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
- return TALER_MHD_reply_static(connection,
- MHD_HTTP_NO_CONTENT,
- NULL,
- NULL,
- 0);
- }
- GNUNET_break(0);
- return MHD_NO;
- }
-} \ No newline at end of file
+ /* execute transaction */
+ qs = TAH_plugin->delete_generic (TAH_plugin->cls,
+ rh->table,
+ row_id);
+ switch (qs)
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_STORE_FAILED,
+ "db store failed");
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ GNUNET_break (0);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE,
+ "unexpected serialization problem");
+ case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_NOT_FOUND,
+ TALER_EC_AUDITOR_RESOURCE_NOT_FOUND,
+ "no delete executed");
+ case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
+ return TALER_MHD_reply_static (connection,
+ MHD_HTTP_NO_CONTENT,
+ NULL,
+ NULL,
+ 0);
+ }
+ GNUNET_break (0);
+ return MHD_NO;
+}
diff --git a/src/auditor/taler-auditor-httpd_patch_generic_suppressed.c b/src/auditor/taler-auditor-httpd_patch_generic_suppressed.c
index fa2da2384..841f7a824 100644
--- a/src/auditor/taler-auditor-httpd_patch_generic_suppressed.c
+++ b/src/auditor/taler-auditor-httpd_patch_generic_suppressed.c
@@ -13,8 +13,6 @@
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-
-
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_json_lib.h>
@@ -24,6 +22,7 @@
#include "taler_json_lib.h"
#include "taler_mhd_lib.h"
#include "taler-auditor-httpd.h"
+#include "taler-auditor-httpd_patch_generic_suppressed.h"
MHD_RESULT
diff --git a/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c b/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c
index 39d13b2d6..1ac351b57 100644
--- a/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c
+++ b/src/auditor/taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.c
@@ -13,8 +13,6 @@
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-
-
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_json_lib.h>
@@ -26,14 +24,15 @@
#include "taler-auditor-httpd.h"
#include "taler-auditor-httpd_reserve-balance-summary-wrong-inconsistency-get.h"
+
/**
-* Add reserve-balance-summary-wrong-inconsistency to the list.
-*
-* @param[in,out] cls a `json_t *` array to extend
-* @param serial_id location of the @a dc in the database
-* @param dc struct of inconsistencies
-* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
-*/
+ * Add reserve-balance-summary-wrong-inconsistency to the list.
+ *
+ * @param[in,out] cls a `json_t *` array to extend
+ * @param serial_id location of the @a dc in the database
+ * @param dc struct of inconsistencies
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop iterating
+ */
static enum GNUNET_GenericReturnValue
process_reserve_balance_summary_wrong_inconsistency (
void *cls,
@@ -44,20 +43,15 @@ process_reserve_balance_summary_wrong_inconsistency (
json_t *obj;
obj = GNUNET_JSON_PACK (
-
GNUNET_JSON_pack_int64 ("row_id", serial_id),
GNUNET_JSON_pack_data_auto ("reserve_pub", &dc->reserve_pub),
TALER_JSON_pack_amount ("exchange_amount", &dc->exchange_amount),
TALER_JSON_pack_amount ("auditor_amount", &dc->auditor_amount),
GNUNET_JSON_pack_bool ("suppressed", dc->suppressed)
-
-
);
GNUNET_break (0 ==
json_array_append_new (list,
obj));
-
-
return GNUNET_OK;
}
@@ -73,6 +67,9 @@ TAH_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_handler_get (
{
json_t *ja;
enum GNUNET_DB_QueryStatus qs;
+ int64_t limit = -20;
+ uint64_t offset;
+ bool return_suppressed = false;
(void) rh;
(void) connection_cls;
@@ -87,35 +84,28 @@ TAH_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_handler_get (
TALER_EC_GENERIC_DB_SETUP_FAILED,
NULL);
}
- ja = json_array ();
- GNUNET_break (NULL != ja);
-
- int64_t limit = -20;
- uint64_t offset;
-
TALER_MHD_parse_request_snumber (connection,
"limit",
&limit);
-
if (limit < 0)
offset = INT64_MAX;
else
offset = 0;
-
TALER_MHD_parse_request_number (connection,
"offset",
&offset);
-
- bool return_suppressed = false;
- const char *ret_s = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
-
- if (ret_s != NULL && strcmp (ret_s, "true") == 0)
{
- return_suppressed = true;
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+
+ if (ret_s != NULL && strcmp (ret_s, "true") == 0)
+ {
+ return_suppressed = true;
+ }
}
-
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
qs = TAH_plugin->get_reserve_balance_summary_wrong_inconsistency (
TAH_plugin->cls,
limit,
@@ -130,10 +120,11 @@ TAH_RESERVE_BALANCE_SUMMARY_WRONG_INCONSISTENCY_handler_get (
json_decref (ja);
TALER_LOG_WARNING (
"Failed to handle GET /reserve-balance-summary-wrong-inconsistency");
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_FETCH_FAILED,
- "reserve-balance-summary-wrong-inconsistency");
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_FETCH_FAILED,
+ "reserve-balance-summary-wrong-inconsistency");
}
return TALER_MHD_REPLY_JSON_PACK (
connection,
diff --git a/src/auditor/taler-auditor-httpd_row-inconsistency-get.c b/src/auditor/taler-auditor-httpd_row-inconsistency-get.c
index f1120b674..05bd21280 100644
--- a/src/auditor/taler-auditor-httpd_row-inconsistency-get.c
+++ b/src/auditor/taler-auditor-httpd_row-inconsistency-get.c
@@ -13,8 +13,6 @@
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-
-
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_json_lib.h>
@@ -24,9 +22,9 @@
#include "taler_json_lib.h"
#include "taler_mhd_lib.h"
#include "taler-auditor-httpd.h"
-
#include "taler-auditor-httpd_row-inconsistency-get.h"
+
/**
* Add deposit confirmation to the list.
*
@@ -57,7 +55,6 @@ add_row_inconsistency (
GNUNET_break (0 ==
json_array_append_new (list,
obj));
-
return GNUNET_OK;
}
@@ -73,6 +70,9 @@ TAH_ROW_INCONSISTENCY_handler_get (
{
json_t *ja;
enum GNUNET_DB_QueryStatus qs;
+ int64_t limit = -20;
+ uint64_t offset;
+ bool return_suppressed = false;
(void) rh;
(void) connection_cls;
@@ -87,34 +87,28 @@ TAH_ROW_INCONSISTENCY_handler_get (
TALER_EC_GENERIC_DB_SETUP_FAILED,
NULL);
}
- ja = json_array ();
- GNUNET_break (NULL != ja);
-
- int64_t limit = -20;
- uint64_t offset;
-
TALER_MHD_parse_request_snumber (connection,
"limit",
&limit);
-
if (limit < 0)
offset = INT64_MAX;
else
offset = 0;
-
TALER_MHD_parse_request_number (connection,
"offset",
&offset);
-
- bool return_suppressed = false;
- const char *ret_s = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
- if (ret_s != NULL && strcmp (ret_s, "true") == 0)
{
- return_suppressed = true;
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if (ret_s != NULL && strcmp (ret_s, "true") == 0)
+ {
+ return_suppressed = true;
+ }
}
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
qs = TAH_plugin->get_row_inconsistency (
TAH_plugin->cls,
limit,
@@ -122,7 +116,6 @@ TAH_ROW_INCONSISTENCY_handler_get (
return_suppressed,
&add_row_inconsistency,
ja);
-
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_HARD_ERROR == qs);
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
index 6cd3aa243..491fdd294 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -227,11 +227,6 @@ report_emergency_by_amount (
const struct TALER_Amount *risk,
const struct TALER_Amount *loss)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Reporting emergency on denomination `%s' over loss of %s\n",
- GNUNET_h2s (&issue->denom_hash.hash),
- TALER_amount2s (loss));
-
enum GNUNET_DB_QueryStatus qs;
struct TALER_AUDITORDB_Emergency emergency = {
.denom_loss = *loss,
@@ -242,10 +237,13 @@ report_emergency_by_amount (
.value = *&issue->value
};
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Reporting emergency on denomination `%s' over loss of %s\n",
+ GNUNET_h2s (&issue->denom_hash.hash),
+ TALER_amount2s (loss));
qs = TALER_ARL_adb->insert_emergency (
TALER_ARL_adb->cls,
&emergency);
-
if (qs < 0)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
diff --git a/src/auditor/taler-helper-auditor-deposits.c b/src/auditor/taler-helper-auditor-deposits.c
index 1a6fa23f8..affb8a331 100644
--- a/src/auditor/taler-helper-auditor-deposits.c
+++ b/src/auditor/taler-helper-auditor-deposits.c
@@ -139,7 +139,7 @@ test_dc (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Deleting matching deposit confirmation %llu\n",
(unsigned long long) dc->row_id);
- qs = TALER_ARL_adb->delete_deposit_generic (
+ qs = TALER_ARL_adb->delete_generic (
TALER_ARL_adb->cls,
TALER_AUDITORDB_DEPOSIT_CONFIRMATION,
dc->row_id);