merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit 4bea2392d6c938c7fb5bbec0d3f336e949cc1665
parent cd3071d864eda94562851796f5559e3e90c2d62f
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  9 Sep 2017 22:41:06 +0200

handle a few more asserts more gracefully (#5092)

Diffstat:
Msrc/lib/merchant_api_pay.c | 20++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/lib/merchant_api_pay.c b/src/lib/merchant_api_pay.c @@ -401,7 +401,6 @@ TALER_MERCHANT_pay_frontend (struct GNUNET_CURL_Context *ctx, CURL *eh; struct TALER_Amount total_fee; struct TALER_Amount total_amount; - unsigned int i; if (0 == num_coins) { @@ -409,7 +408,7 @@ TALER_MERCHANT_pay_frontend (struct GNUNET_CURL_Context *ctx, return NULL; } j_coins = json_array (); - for (i=0;i<num_coins;i++) + for (unsigned int i=0;i<num_coins;i++) { json_t *j_coin; const struct TALER_MERCHANT_PaidCoin *pc = &coins[i]; @@ -459,9 +458,14 @@ 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) ); - GNUNET_assert (0 == - json_array_append_new (j_coins, - j_coin)); + if (0 != + json_array_append_new (j_coins, + j_coin)) + { + GNUNET_break (0); + json_decref (j_coins); + return NULL; + } } pay_obj = json_pack ("{" @@ -474,7 +478,11 @@ TALER_MERCHANT_pay_frontend (struct GNUNET_CURL_Context *ctx, "coins", j_coins, "order_id", order_id, "merchant_pub", GNUNET_JSON_from_data_auto (merchant_pub)); - + if (NULL == pay_obj) + { + GNUNET_break (0); + return NULL; + } ph = GNUNET_new (struct TALER_MERCHANT_Pay); ph->ctx = ctx; ph->cb = pay_cb;