gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-merchant] branch master updated: handle a few more a


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated: handle a few more asserts more gracefully (#5092)
Date: Sat, 09 Sep 2017 22:42:04 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 4bea239  handle a few more asserts more gracefully (#5092)
4bea239 is described below

commit 4bea2392d6c938c7fb5bbec0d3f336e949cc1665
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Sep 9 22:41:06 2017 +0200

    handle a few more asserts more gracefully (#5092)
---
 src/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
index e65ecb4..a480061 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;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]