commit 0ced3cb8b36fae93fefbc5967adbb9f755d7604c
parent ded0de99aa69f3113f54b7e3fa4dfec530f09372
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 11 Jun 2016 13:50:16 +0200
check return values of json_array_append
Diffstat:
4 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_auditors.c b/src/backend/taler-merchant-httpd_auditors.c
@@ -207,11 +207,12 @@ TMH_AUDITORS_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
/* Generate preferred exchange(s) array. */
j_auditors = json_array ();
for (cnt = 0; cnt < nauditors; cnt++)
- json_array_append_new (j_auditors,
- json_pack ("{s:s, s:o, s:s}",
- "name", auditors[cnt].name,
- "auditor_pub", GNUNET_JSON_from_data_auto (&auditors[cnt].public_key),
- "uri", auditors[cnt].uri));
+ GNUNET_assert (0 ==
+ json_array_append_new (j_auditors,
+ json_pack ("{s:s, s:o, s:s}",
+ "name", auditors[cnt].name,
+ "auditor_pub", GNUNET_JSON_from_data_auto (&auditors[cnt].public_key),
+ "uri", auditors[cnt].uri)));
return nauditors;
}
diff --git a/src/backend/taler-merchant-httpd_exchanges.c b/src/backend/taler-merchant-httpd_exchanges.c
@@ -539,8 +539,9 @@ TMH_EXCHANGES_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
j_exchange = json_pack ("{s:s, s:o}",
"url", exchange->uri,
"master_pub", GNUNET_JSON_from_data_auto (&exchange->master_pub));
- json_array_append_new (trusted_exchanges,
- j_exchange);
+ GNUNET_assert (0 ==
+ json_array_append_new (trusted_exchanges,
+ j_exchange));
}
return GNUNET_OK;
}
diff --git a/src/backend/taler-merchant-httpd_responses.c b/src/backend/taler-merchant-httpd_responses.c
@@ -391,16 +391,18 @@ TMH_RESPONSE_make_track_transaction_ok (unsigned int num_transfers,
{
const struct TALER_MERCHANT_CoinWireTransfer *coin = &transfer->coins[j];
- json_array_append_new (j_coins,
- json_pack ("{s:o, s:o, s:o}",
- "coin_pub", GNUNET_JSON_from_data_auto (&coin->coin_pub),
- "amount_with_fee", TALER_JSON_from_amount (&coin->amount_with_fee),
- "deposit_fee", TALER_JSON_from_amount (&coin->deposit_fee)));
+ GNUNET_assert (0 ==
+ json_array_append_new (j_coins,
+ json_pack ("{s:o, s:o, s:o}",
+ "coin_pub", GNUNET_JSON_from_data_auto (&coin->coin_pub),
+ "amount_with_fee", TALER_JSON_from_amount (&coin->amount_with_fee),
+ "deposit_fee", TALER_JSON_from_amount (&coin->deposit_fee))));
}
- json_array_append_new (j_transfers,
- json_pack ("{s:o, s:o}",
- "wtid", GNUNET_JSON_from_data_auto (&transfer->wtid),
- "coins", j_coins));
+ GNUNET_assert (0 ==
+ json_array_append_new (j_transfers,
+ json_pack ("{s:o, s:o}",
+ "wtid", GNUNET_JSON_from_data_auto (&transfer->wtid),
+ "coins", j_coins)));
}
ret = TMH_RESPONSE_make_json (j_transfers);
json_decref (j_transfers);
diff --git a/src/lib/merchant_api_pay.c b/src/lib/merchant_api_pay.c
@@ -464,8 +464,9 @@ TALER_MERCHANT_pay_frontend (struct GNUNET_CURL_Context *ctx,
"ub_sig", GNUNET_JSON_from_rsa_signature (pc->denom_sig.rsa_signature),
"coin_sig", GNUNET_JSON_from_data_auto (&pc->coin_sig)
);
- json_array_append (j_coins,
- j_coin);
+ GNUNET_assert (0 ==
+ json_array_append (j_coins,
+ j_coin));
}
{ /* Sanity check that total_amount and total_fee