commit 93e69c3d78342eb24f20cdfa83553e709a210f20
parent cc4dff02c88437698bc4b786c5520c0167880edd
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Sat, 23 Aug 2025 22:08:42 +0200
check return values
Diffstat:
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/lib/taler_merchant_pay_service.c b/src/lib/taler_merchant_pay_service.c
@@ -752,6 +752,8 @@ TALER_MERCHANT_order_pay_set_options (
{
/* build and store tokens_evs */
json_t *arr = json_array ();
+
+ GNUNET_assert (NULL != arr);
for (unsigned j = 0; j < ph->output_tokens.num_output_tokens; j++)
{
const struct TALER_MERCHANT_OutputToken *otk =
@@ -867,9 +869,11 @@ TALER_MERCHANT_order_pay_start (struct TALER_MERCHANT_OrderPayHandle *ph)
/* sign coins AND build the “coins” JSON in one pass */
{
+ struct TALER_Amount total_fee;
+ struct TALER_Amount total_amount;
json_t *arr = json_array ();
- struct TALER_Amount total_fee, total_amount;
+ GNUNET_assert (NULL != arr);
for (unsigned i = 0; i < ph->coins.num_coins; i++)
{
const struct TALER_MERCHANT_PayCoin *c = &ph->coins.coins[i];
@@ -926,8 +930,9 @@ TALER_MERCHANT_order_pay_start (struct TALER_MERCHANT_OrderPayHandle *ph)
&pc.denom_sig),
GNUNET_JSON_pack_data_auto ("coin_sig",
&pc.coin_sig));
- json_array_append_new (arr,
- je);
+ GNUNET_assert (0 ==
+ json_array_append_new (arr,
+ je));
/* optional totals if you need them later
(kept here because they existed in the legacy code) */
@@ -973,6 +978,8 @@ TALER_MERCHANT_order_pay_start (struct TALER_MERCHANT_OrderPayHandle *ph)
{
struct TALER_MERCHANT_UsedToken ut[ph->input_tokens.num_tokens];
json_t *arr = json_array ();
+
+ GNUNET_assert (NULL != arr);
for (unsigned i = 0; i < ph->input_tokens.num_tokens; i++)
{
json_t *je;
@@ -1000,8 +1007,9 @@ TALER_MERCHANT_order_pay_start (struct TALER_MERCHANT_OrderPayHandle *ph)
GNUNET_JSON_pack_data_auto ("token_pub",
&t->token_pub)
);
- json_array_append_new (arr,
- je);
+ GNUNET_assert (0 ==
+ json_array_append_new (arr,
+ je));
}
store_json_option (ph,