diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-09-09 22:41:06 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-09-09 22:41:06 +0200 |
commit | 4bea2392d6c938c7fb5bbec0d3f336e949cc1665 (patch) | |
tree | 941c43d68bb3b32db5efa37949b00351836ce17e /src/lib/merchant_api_pay.c | |
parent | cd3071d864eda94562851796f5559e3e90c2d62f (diff) | |
download | merchant-4bea2392d6c938c7fb5bbec0d3f336e949cc1665.tar.gz merchant-4bea2392d6c938c7fb5bbec0d3f336e949cc1665.tar.bz2 merchant-4bea2392d6c938c7fb5bbec0d3f336e949cc1665.zip |
handle a few more asserts more gracefully (#5092)
Diffstat (limited to 'src/lib/merchant_api_pay.c')
-rw-r--r-- | src/lib/merchant_api_pay.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/lib/merchant_api_pay.c b/src/lib/merchant_api_pay.c index e65ecb4c..a4800617 100644 --- 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; |