gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -fix minor bugs


From: gnunet
Subject: [taler-exchange] branch master updated: -fix minor bugs
Date: Tue, 07 Jun 2022 15:02:21 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new b9a30d29 -fix minor bugs
b9a30d29 is described below

commit b9a30d29cb91ec66c3bb8d956640d20e641b6a4d
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Jun 7 15:02:08 2022 +0200

    -fix minor bugs
---
 contrib/gana                                       |  2 +-
 src/benchmark/taler-aggregator-benchmark.c         |  3 +++
 src/exchange-tools/taler-crypto-worker.c           | 22 +++++++++++----------
 src/exchange/taler-exchange-httpd_batch-withdraw.c |  5 +++--
 src/exchange/taler-exchange-httpd_purses_create.c  | 23 ++++++++++++++++++----
 src/exchange/taler-exchange-httpd_purses_merge.c   | 10 ++++++----
 .../taler-exchange-httpd_reserves_history.c        | 18 +++++++++++++++--
 src/exchange/taler-exchange-httpd_reserves_purse.c | 18 +++++++++++++++--
 src/exchangedb/plugin_exchangedb_postgres.c        |  5 +++--
 src/include/taler_exchange_service.h               |  1 -
 src/lib/exchange_api_auditor_add_denomination.c    | 13 ++++++------
 src/lib/exchange_api_batch_withdraw2.c             |  5 +++--
 src/lib/exchange_api_management_auditor_disable.c  | 13 ++++++------
 src/lib/exchange_api_management_auditor_enable.c   | 13 ++++++------
 src/lib/exchange_api_management_post_extensions.c  | 19 +++++++++---------
 src/lib/exchange_api_management_post_keys.c        | 13 ++++++------
 ...change_api_management_revoke_denomination_key.c | 12 ++++++-----
 .../exchange_api_management_revoke_signing_key.c   | 13 ++++++------
 src/lib/exchange_api_management_set_global_fee.c   | 13 ++++++------
 src/lib/exchange_api_management_set_wire_fee.c     | 13 ++++++------
 src/lib/exchange_api_management_wire_disable.c     | 13 ++++++------
 src/lib/exchange_api_management_wire_enable.c      | 13 ++++++------
 src/lib/exchange_api_purse_create_with_merge.c     |  6 +++---
 src/testing/testing_api_cmd_purse_merge.c          |  6 ++++--
 src/util/taler-exchange-secmod-cs.c                |  2 +-
 src/util/taler-exchange-secmod-eddsa.c             |  2 ++
 src/util/taler-exchange-secmod-rsa.c               |  5 +++--
 27 files changed, 174 insertions(+), 107 deletions(-)

diff --git a/contrib/gana b/contrib/gana
index d4234f34..75c838e7 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit d4234f340c6e7261de36ab5fad3d53597ea8ecd0
+Subproject commit 75c838e74c41bf9a6c02cdfe8109a444056bf26d
diff --git a/src/benchmark/taler-aggregator-benchmark.c 
b/src/benchmark/taler-aggregator-benchmark.c
index 7748f583..665077be 100644
--- a/src/benchmark/taler-aggregator-benchmark.c
+++ b/src/benchmark/taler-aggregator-benchmark.c
@@ -283,6 +283,9 @@ add_deposit (const struct Merchant *m)
   d.coin.denom_pub_hash = h_denom_pub;
   d.coin.denom_sig = denom_sig;
   RANDOMIZE (&d.h_contract_terms);
+  memset (&d.coin.h_age_commitment,
+          0,
+          sizeof (d.coin.h_age_commitment));
 
   if (0 >=
       plugin->ensure_coin_known (plugin->cls,
diff --git a/src/exchange-tools/taler-crypto-worker.c 
b/src/exchange-tools/taler-crypto-worker.c
index d5ba4fee..a1db1e81 100644
--- a/src/exchange-tools/taler-crypto-worker.c
+++ b/src/exchange-tools/taler-crypto-worker.c
@@ -270,25 +270,27 @@ run (void *cls,
                                   &msg_size),
         GNUNET_JSON_spec_end ()
       };
-      if (GNUNET_OK != GNUNET_JSON_parse (args,
-                                          eddsa_sign_spec,
-                                          NULL,
-                                          NULL))
+      if (GNUNET_OK !=
+          GNUNET_JSON_parse (args,
+                             eddsa_sign_spec,
+                             NULL,
+                             NULL))
       {
         GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                     "malformed op args\n");
         global_ret = 1;
         return;
       }
-      GNUNET_CRYPTO_eddsa_sign_ (
-        &priv,
-        msg,
-        &sig
-        );
+      GNUNET_assert (GNUNET_OK ==
+                     GNUNET_CRYPTO_eddsa_sign_ (
+                       &priv,
+                       msg,
+                       &sig));
       resp = GNUNET_JSON_PACK (
         GNUNET_JSON_pack_data_auto ("sig", &sig)
         );
-      json_dumpf (resp, stdout, JSON_COMPACT);
+      json_dumpf (resp, stdout,
+                  JSON_COMPACT);
       printf ("\n");
       fflush (stdout);
       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
diff --git a/src/exchange/taler-exchange-httpd_batch-withdraw.c 
b/src/exchange/taler-exchange-httpd_batch-withdraw.c
index 52f42036..91d1ebd3 100644
--- a/src/exchange/taler-exchange-httpd_batch-withdraw.c
+++ b/src/exchange/taler-exchange-httpd_batch-withdraw.c
@@ -628,8 +628,9 @@ TEH_handler_batch_withdraw (struct TEH_RequestContext *rc,
   memset (&wc,
           0,
           sizeof (wc));
-  TALER_amount_set_zero (TEH_currency,
-                         &wc.batch_total);
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_amount_set_zero (TEH_currency,
+                                        &wc.batch_total));
   wc.reserve_pub = reserve_pub;
 
   {
diff --git a/src/exchange/taler-exchange-httpd_purses_create.c 
b/src/exchange/taler-exchange-httpd_purses_create.c
index d6c942c6..cc5478d1 100644
--- a/src/exchange/taler-exchange-httpd_purses_create.c
+++ b/src/exchange/taler-exchange-httpd_purses_create.c
@@ -207,8 +207,9 @@ create_transaction (void *cls,
   struct TALER_Amount purse_fee;
   bool in_conflict = true;
 
-  TALER_amount_set_zero (pcc->amount.currency,
-                         &purse_fee);
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_amount_set_zero (pcc->amount.currency,
+                                        &purse_fee));
   /* 1) create purse */
   qs = TEH_plugin->insert_purse_request (
     TEH_plugin->cls,
@@ -739,8 +740,22 @@ TEH_handler_purses_create (
                                        TALER_EC_GENERIC_PARAMETER_MALFORMED,
                                        "deposits");
   }
-  gf = TEH_keys_global_fee_by_time (TEH_keys_get_state (),
-                                    pcc.exchange_timestamp);
+  {
+    struct TEH_KeyStateHandle *keys;
+
+    keys = TEH_keys_get_state ();
+    if (NULL == keys)
+    {
+      GNUNET_break (0);
+      GNUNET_JSON_parse_free (spec);
+      return TALER_MHD_reply_with_error (connection,
+                                         MHD_HTTP_INTERNAL_SERVER_ERROR,
+                                         
TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING,
+                                         NULL);
+    }
+    gf = TEH_keys_global_fee_by_time (keys,
+                                      pcc.exchange_timestamp);
+  }
   if (NULL == gf)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
diff --git a/src/exchange/taler-exchange-httpd_purses_merge.c 
b/src/exchange/taler-exchange-httpd_purses_merge.c
index 5f09f198..144571d2 100644
--- a/src/exchange/taler-exchange-httpd_purses_merge.c
+++ b/src/exchange/taler-exchange-httpd_purses_merge.c
@@ -162,8 +162,9 @@ reply_merge_success (struct MHD_Connection *connection,
                                &pcc->target_amount,
                                &pcc->wf->wad))
     {
-      TALER_amount_set_zero (TEH_currency,
-                             &merge_amount);
+      GNUNET_assert (GNUNET_OK ==
+                     TALER_amount_set_zero (TEH_currency,
+                                            &merge_amount));
     }
   }
   if (TALER_EC_NONE !=
@@ -524,8 +525,9 @@ TEH_handler_purses_merge (
   {
     struct TALER_Amount zero_purse_fee;
 
-    TALER_amount_set_zero (pcc.target_amount.currency,
-                           &zero_purse_fee);
+    GNUNET_assert (GNUNET_OK ==
+                   TALER_amount_set_zero (pcc.target_amount.currency,
+                                          &zero_purse_fee));
     if (GNUNET_OK !=
         TALER_wallet_account_merge_verify (
           pcc.merge_timestamp,
diff --git a/src/exchange/taler-exchange-httpd_reserves_history.c 
b/src/exchange/taler-exchange-httpd_reserves_history.c
index 4766dadc..1392dfc5 100644
--- a/src/exchange/taler-exchange-httpd_reserves_history.c
+++ b/src/exchange/taler-exchange-httpd_reserves_history.c
@@ -232,8 +232,22 @@ TEH_handler_reserves_history (struct TEH_RequestContext 
*rc,
                                        TALER_EC_EXCHANGE_GENERIC_CLOCK_SKEW,
                                        NULL);
   }
-  rsc.gf = TEH_keys_global_fee_by_time (TEH_keys_get_state (),
-                                        rsc.timestamp);
+  {
+    struct TEH_KeyStateHandle *keys;
+
+    keys = TEH_keys_get_state ();
+    if (NULL == keys)
+    {
+      GNUNET_break (0);
+      GNUNET_JSON_parse_free (spec);
+      return TALER_MHD_reply_with_error (rc->connection,
+                                         MHD_HTTP_INTERNAL_SERVER_ERROR,
+                                         
TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING,
+                                         NULL);
+    }
+    rsc.gf = TEH_keys_global_fee_by_time (keys,
+                                          rsc.timestamp);
+  }
   if (NULL == rsc.gf)
   {
     GNUNET_break (0);
diff --git a/src/exchange/taler-exchange-httpd_reserves_purse.c 
b/src/exchange/taler-exchange-httpd_reserves_purse.c
index 7aa00a50..fcf688d4 100644
--- a/src/exchange/taler-exchange-httpd_reserves_purse.c
+++ b/src/exchange/taler-exchange-httpd_reserves_purse.c
@@ -557,8 +557,22 @@ TEH_handler_reserves_purse (
                                        
TALER_EC_EXCHANGE_RESERVES_PURSE_EXPIRATION_IS_NEVER,
                                        NULL);
   }
-  rpc.gf = TEH_keys_global_fee_by_time (TEH_keys_get_state (),
-                                        rpc.exchange_timestamp);
+  {
+    struct TEH_KeyStateHandle *keys;
+
+    keys = TEH_keys_get_state ();
+    if (NULL == keys)
+    {
+      GNUNET_break (0);
+      GNUNET_JSON_parse_free (spec);
+      return TALER_MHD_reply_with_error (connection,
+                                         MHD_HTTP_INTERNAL_SERVER_ERROR,
+                                         
TALER_EC_EXCHANGE_GENERIC_KEYS_MISSING,
+                                         NULL);
+    }
+    rpc.gf = TEH_keys_global_fee_by_time (keys,
+                                          rpc.exchange_timestamp);
+  }
   if (NULL == rpc.gf)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c 
b/src/exchangedb/plugin_exchangedb_postgres.c
index 0dbd804b..e933bfcf 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -14594,8 +14594,9 @@ postgres_do_reserve_purse (
     GNUNET_PQ_result_spec_end
   };
 
-  TALER_amount_set_zero (pg->currency,
-                         &zero_fee);
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_amount_set_zero (pg->currency,
+                                        &zero_fee));
   return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
                                                    "call_reserve_purse",
                                                    params,
diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index 03223edc..2d801245 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -423,7 +423,6 @@ struct TALER_EXCHANGE_HttpResponse
    * reply (too big, invalid JSON).
    */
   const json_t *reply;
-
   /**
    * Set to the human-readable 'hint' that is optionally
    * provided by the exchange together with errors. NULL
diff --git a/src/lib/exchange_api_auditor_add_denomination.c 
b/src/lib/exchange_api_auditor_add_denomination.c
index d01252a8..71f421d4 100644
--- a/src/lib/exchange_api_auditor_add_denomination.c
+++ b/src/lib/exchange_api_auditor_add_denomination.c
@@ -192,16 +192,17 @@ TALER_EXCHANGE_add_auditor_denomination (
     GNUNET_JSON_pack_data_auto ("auditor_sig",
                                 auditor_sig));
   eh = TALER_AUDITOR_curl_easy_get_ (ah->url);
-  GNUNET_assert (NULL != eh);
-  if (GNUNET_OK !=
-      TALER_curl_easy_post (&ah->post_ctx,
-                            eh,
-                            body))
+  if ( (NULL == eh) ||
+       (GNUNET_OK !=
+        TALER_curl_easy_post (&ah->post_ctx,
+                              eh,
+                              body)) )
   {
     GNUNET_break (0);
+    if (NULL != eh)
+      curl_easy_cleanup (eh);
     json_decref (body);
     GNUNET_free (ah->url);
-    GNUNET_free (eh);
     return NULL;
   }
   json_decref (body);
diff --git a/src/lib/exchange_api_batch_withdraw2.c 
b/src/lib/exchange_api_batch_withdraw2.c
index 52da9b40..e9da2199 100644
--- a/src/lib/exchange_api_batch_withdraw2.c
+++ b/src/lib/exchange_api_batch_withdraw2.c
@@ -414,8 +414,9 @@ TALER_EXCHANGE_batch_withdraw2 (
   wh->cb = res_cb;
   wh->cb_cls = res_cb_cls;
   wh->num_coins = pds_length;
-  TALER_amount_set_zero (keys->currency,
-                         &wh->requested_amount);
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_amount_set_zero (keys->currency,
+                                        &wh->requested_amount));
   GNUNET_CRYPTO_eddsa_key_get_public (&reserve_priv->eddsa_priv,
                                       &wh->reserve_pub.eddsa_pub);
   {
diff --git a/src/lib/exchange_api_management_auditor_disable.c 
b/src/lib/exchange_api_management_auditor_disable.c
index bfe60ee7..b1de80f0 100644
--- a/src/lib/exchange_api_management_auditor_disable.c
+++ b/src/lib/exchange_api_management_auditor_disable.c
@@ -173,16 +173,17 @@ TALER_EXCHANGE_management_disable_auditor (
     GNUNET_JSON_pack_timestamp ("validity_end",
                                 validity_end));
   eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
-  GNUNET_assert (NULL != eh);
-  if (GNUNET_OK !=
-      TALER_curl_easy_post (&ah->post_ctx,
-                            eh,
-                            body))
+  if ( (NULL == eh) ||
+       (GNUNET_OK !=
+        TALER_curl_easy_post (&ah->post_ctx,
+                              eh,
+                              body)))
   {
     GNUNET_break (0);
+    if (NULL != eh)
+      curl_easy_cleanup (eh);
     json_decref (body);
     GNUNET_free (ah->url);
-    GNUNET_free (eh);
     return NULL;
   }
   json_decref (body);
diff --git a/src/lib/exchange_api_management_auditor_enable.c 
b/src/lib/exchange_api_management_auditor_enable.c
index a9944930..af75215e 100644
--- a/src/lib/exchange_api_management_auditor_enable.c
+++ b/src/lib/exchange_api_management_auditor_enable.c
@@ -163,16 +163,17 @@ TALER_EXCHANGE_management_enable_auditor (
     GNUNET_JSON_pack_timestamp ("validity_start",
                                 validity_start));
   eh = TALER_EXCHANGE_curl_easy_get_ (ah->url);
-  GNUNET_assert (NULL != eh);
-  if (GNUNET_OK !=
-      TALER_curl_easy_post (&ah->post_ctx,
-                            eh,
-                            body))
+  if ( (NULL == eh) ||
+       (GNUNET_OK !=
+        TALER_curl_easy_post (&ah->post_ctx,
+                              eh,
+                              body)) )
   {
     GNUNET_break (0);
     json_decref (body);
+    if (NULL != eh)
+      curl_easy_cleanup (eh);
     GNUNET_free (ah->url);
-    GNUNET_free (eh);
     return NULL;
   }
   json_decref (body);
diff --git a/src/lib/exchange_api_management_post_extensions.c 
b/src/lib/exchange_api_management_post_extensions.c
index 87b0e0be..544f85ef 100644
--- a/src/lib/exchange_api_management_post_extensions.c
+++ b/src/lib/exchange_api_management_post_extensions.c
@@ -23,6 +23,7 @@
 #include "taler_json_lib.h"
 #include <gnunet/gnunet_curl_lib.h>
 #include "taler_extensions.h"
+#include "exchange_api_curl_defaults.h"
 #include "taler_exchange_service.h"
 #include "taler_signatures.h"
 #include "taler_curl_lib.h"
@@ -154,26 +155,24 @@ TALER_EXCHANGE_management_post_extensions (
     GNUNET_JSON_pack_data_auto ("extensions_sig",
                                 &ped->extensions_sig));
 
-  eh = curl_easy_init ();
-  GNUNET_assert (NULL != eh);
-  if (GNUNET_OK !=
-      TALER_curl_easy_post (&ph->post_ctx,
-                            eh,
-                            body))
+  eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
+  if ( (NULL == eh) ||
+       (GNUNET_OK !=
+        TALER_curl_easy_post (&ph->post_ctx,
+                              eh,
+                              body)) )
   {
     GNUNET_break (0);
+    if (NULL != eh)
+      curl_easy_cleanup (eh);
     json_decref (body);
     GNUNET_free (ph->url);
-    GNUNET_free (eh);
     return NULL;
   }
   json_decref (body);
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Requesting URL '%s'\n",
               ph->url);
-  GNUNET_assert (CURLE_OK == curl_easy_setopt (eh,
-                                               CURLOPT_URL,
-                                               ph->url));
   ph->job = GNUNET_CURL_job_add2 (ctx,
                                   eh,
                                   ph->post_ctx.headers,
diff --git a/src/lib/exchange_api_management_post_keys.c 
b/src/lib/exchange_api_management_post_keys.c
index d7790599..291c0ac0 100644
--- a/src/lib/exchange_api_management_post_keys.c
+++ b/src/lib/exchange_api_management_post_keys.c
@@ -191,16 +191,17 @@ TALER_EXCHANGE_post_management_keys (
     GNUNET_JSON_pack_array_steal ("signkey_sigs",
                                   signkey_sigs));
   eh = TALER_EXCHANGE_curl_easy_get_ (ph->url);
-  GNUNET_assert (NULL != eh);
-  if (GNUNET_OK !=
-      TALER_curl_easy_post (&ph->post_ctx,
-                            eh,
-                            body))
+  if ( (NULL == eh) ||
+       (GNUNET_OK !=
+        TALER_curl_easy_post (&ph->post_ctx,
+                              eh,
+                              body)) )
   {
     GNUNET_break (0);
+    if (NULL != eh)
+      curl_easy_cleanup (eh);
     json_decref (body);
     GNUNET_free (ph->url);
-    GNUNET_free (eh);
     return NULL;
   }
   json_decref (body);
diff --git a/src/lib/exchange_api_management_revoke_denomination_key.c 
b/src/lib/exchange_api_management_revoke_denomination_key.c
index f7ddeaed..8d65b645 100644
--- a/src/lib/exchange_api_management_revoke_denomination_key.c
+++ b/src/lib/exchange_api_management_revoke_denomination_key.c
@@ -175,15 +175,17 @@ TALER_EXCHANGE_management_revoke_denomination_key (
     return NULL;
   }
   eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
-  if (GNUNET_OK !=
-      TALER_curl_easy_post (&rh->post_ctx,
-                            eh,
-                            body))
+  if ( (NULL == eh) ||
+       (GNUNET_OK !=
+        TALER_curl_easy_post (&rh->post_ctx,
+                              eh,
+                              body)) )
   {
     GNUNET_break (0);
+    if (NULL != eh)
+      curl_easy_cleanup (eh);
     json_decref (body);
     GNUNET_free (rh->url);
-    GNUNET_free (eh);
     return NULL;
   }
   json_decref (body);
diff --git a/src/lib/exchange_api_management_revoke_signing_key.c 
b/src/lib/exchange_api_management_revoke_signing_key.c
index 046d1872..aac27678 100644
--- a/src/lib/exchange_api_management_revoke_signing_key.c
+++ b/src/lib/exchange_api_management_revoke_signing_key.c
@@ -165,16 +165,17 @@ TALER_EXCHANGE_management_revoke_signing_key (
     GNUNET_JSON_pack_data_auto ("master_sig",
                                 master_sig));
   eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
-  GNUNET_assert (NULL != eh);
-  if (GNUNET_OK !=
-      TALER_curl_easy_post (&rh->post_ctx,
-                            eh,
-                            body))
+  if ( (NULL == eh) ||
+       (GNUNET_OK !=
+        TALER_curl_easy_post (&rh->post_ctx,
+                              eh,
+                              body)) )
   {
     GNUNET_break (0);
+    if (NULL != eh)
+      curl_easy_cleanup (eh);
     json_decref (body);
     GNUNET_free (rh->url);
-    GNUNET_free (eh);
     return NULL;
   }
   json_decref (body);
diff --git a/src/lib/exchange_api_management_set_global_fee.c 
b/src/lib/exchange_api_management_set_global_fee.c
index a79dddc9..b600c8cb 100644
--- a/src/lib/exchange_api_management_set_global_fee.c
+++ b/src/lib/exchange_api_management_set_global_fee.c
@@ -179,16 +179,17 @@ TALER_EXCHANGE_management_set_global_fees (
     GNUNET_JSON_pack_uint64 ("purse_account_limit",
                              purse_account_limit));
   eh = TALER_EXCHANGE_curl_easy_get_ (sgfh->url);
-  GNUNET_assert (NULL != eh);
-  if (GNUNET_OK !=
-      TALER_curl_easy_post (&sgfh->post_ctx,
-                            eh,
-                            body))
+  if ( (NULL == eh) ||
+       (GNUNET_OK !=
+        TALER_curl_easy_post (&sgfh->post_ctx,
+                              eh,
+                              body)) )
   {
     GNUNET_break (0);
+    if (NULL != eh)
+      curl_easy_cleanup (eh);
     json_decref (body);
     GNUNET_free (sgfh->url);
-    GNUNET_free (eh);
     return NULL;
   }
   json_decref (body);
diff --git a/src/lib/exchange_api_management_set_wire_fee.c 
b/src/lib/exchange_api_management_set_wire_fee.c
index 84c6fe90..5951b6e2 100644
--- a/src/lib/exchange_api_management_set_wire_fee.c
+++ b/src/lib/exchange_api_management_set_wire_fee.c
@@ -168,16 +168,17 @@ TALER_EXCHANGE_management_set_wire_fees (
     TALER_JSON_pack_amount ("wire_fee",
                             &fees->wire));
   eh = TALER_EXCHANGE_curl_easy_get_ (swfh->url);
-  GNUNET_assert (NULL != eh);
-  if (GNUNET_OK !=
-      TALER_curl_easy_post (&swfh->post_ctx,
-                            eh,
-                            body))
+  if ( (NULL == eh) ||
+       (GNUNET_OK !=
+        TALER_curl_easy_post (&swfh->post_ctx,
+                              eh,
+                              body)) )
   {
     GNUNET_break (0);
+    if (NULL != eh)
+      curl_easy_cleanup (eh);
     json_decref (body);
     GNUNET_free (swfh->url);
-    GNUNET_free (eh);
     return NULL;
   }
   json_decref (body);
diff --git a/src/lib/exchange_api_management_wire_disable.c 
b/src/lib/exchange_api_management_wire_disable.c
index 3bae8e3a..5d97eef7 100644
--- a/src/lib/exchange_api_management_wire_disable.c
+++ b/src/lib/exchange_api_management_wire_disable.c
@@ -163,16 +163,17 @@ TALER_EXCHANGE_management_disable_wire (
     GNUNET_JSON_pack_timestamp ("validity_end",
                                 validity_end));
   eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
-  GNUNET_assert (NULL != eh);
-  if (GNUNET_OK !=
-      TALER_curl_easy_post (&wh->post_ctx,
-                            eh,
-                            body))
+  if ( (NULL == eh) ||
+       (GNUNET_OK !=
+        TALER_curl_easy_post (&wh->post_ctx,
+                              eh,
+                              body)) )
   {
     GNUNET_break (0);
+    if (NULL != eh)
+      curl_easy_cleanup (eh);
     json_decref (body);
     GNUNET_free (wh->url);
-    GNUNET_free (eh);
     return NULL;
   }
   json_decref (body);
diff --git a/src/lib/exchange_api_management_wire_enable.c 
b/src/lib/exchange_api_management_wire_enable.c
index 6e3dbad1..55480474 100644
--- a/src/lib/exchange_api_management_wire_enable.c
+++ b/src/lib/exchange_api_management_wire_enable.c
@@ -174,16 +174,17 @@ TALER_EXCHANGE_management_enable_wire (
     GNUNET_JSON_pack_timestamp ("validity_start",
                                 validity_start));
   eh = TALER_EXCHANGE_curl_easy_get_ (wh->url);
-  GNUNET_assert (NULL != eh);
-  if (GNUNET_OK !=
-      TALER_curl_easy_post (&wh->post_ctx,
-                            eh,
-                            body))
+  if ( (NULL == eh) ||
+       (GNUNET_OK !=
+        TALER_curl_easy_post (&wh->post_ctx,
+                              eh,
+                              body)) )
   {
     GNUNET_break (0);
+    if (NULL != eh)
+      curl_easy_cleanup (eh);
     json_decref (body);
     GNUNET_free (wh->url);
-    GNUNET_free (eh);
     return NULL;
   }
   json_decref (body);
diff --git a/src/lib/exchange_api_purse_create_with_merge.c 
b/src/lib/exchange_api_purse_create_with_merge.c
index 4ca63336..2b4f1cd2 100644
--- a/src/lib/exchange_api_purse_create_with_merge.c
+++ b/src/lib/exchange_api_purse_create_with_merge.c
@@ -357,7 +357,6 @@ TALER_EXCHANGE_purse_create_with_merge (
     GNUNET_free (pcm);
     return NULL;
   }
-  pcm->h_contract_terms = pcm->h_contract_terms;
   pcm->merge_timestamp = merge_timestamp;
   GNUNET_CRYPTO_eddsa_key_get_public (&purse_priv->eddsa_priv,
                                       &pcm->purse_pub.eddsa_pub);
@@ -401,8 +400,9 @@ TALER_EXCHANGE_purse_create_with_merge (
   }
   else
   {
-    TALER_amount_set_zero (pcm->purse_value_after_fees.currency,
-                           &purse_fee);
+    GNUNET_assert (GNUNET_OK ==
+                   TALER_amount_set_zero (pcm->purse_value_after_fees.currency,
+                                          &purse_fee));
     flags = TALER_WAMF_MODE_CREATE_FROM_PURSE_QUOTA;
   }
 
diff --git a/src/testing/testing_api_cmd_purse_merge.c 
b/src/testing/testing_api_cmd_purse_merge.c
index 68cd5ea5..f2290523 100644
--- a/src/testing/testing_api_cmd_purse_merge.c
+++ b/src/testing/testing_api_cmd_purse_merge.c
@@ -133,8 +133,10 @@ merge_cb (void *cls,
   {
     ds->reserve_history.type = TALER_EXCHANGE_RTT_MERGE;
     ds->reserve_history.amount = ds->value_after_fees;
-    TALER_amount_set_zero (ds->value_after_fees.currency,
-                           
&ds->reserve_history.details.merge_details.purse_fee);
+    GNUNET_assert (GNUNET_OK ==
+                   TALER_amount_set_zero (
+                     ds->value_after_fees.currency,
+                     &ds->reserve_history.details.merge_details.purse_fee));
     ds->reserve_history.details.merge_details.h_contract_terms
       = ds->h_contract_terms;
     ds->reserve_history.details.merge_details.merge_pub
diff --git a/src/util/taler-exchange-secmod-cs.c 
b/src/util/taler-exchange-secmod-cs.c
index 33167c8e..ffd12dee 100644
--- a/src/util/taler-exchange-secmod-cs.c
+++ b/src/util/taler-exchange-secmod-cs.c
@@ -1215,7 +1215,6 @@ import_key (void *cls,
     GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
                               "open",
                               filename);
-    GNUNET_break (0 == close (fd));
     return GNUNET_OK;
   }
   if (0 != fstat (fd,
@@ -1224,6 +1223,7 @@ import_key (void *cls,
     GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
                               "stat",
                               filename);
+    GNUNET_break (0 == close (fd));
     return GNUNET_OK;
   }
   if (! S_ISREG (sbuf.st_mode))
diff --git a/src/util/taler-exchange-secmod-eddsa.c 
b/src/util/taler-exchange-secmod-eddsa.c
index 21aedbc2..9f6f6d74 100644
--- a/src/util/taler-exchange-secmod-eddsa.c
+++ b/src/util/taler-exchange-secmod-eddsa.c
@@ -918,6 +918,7 @@ import_key (void *cls,
     GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
                               "stat",
                               filename);
+    GNUNET_break (0 == close (fd));
     return GNUNET_OK;
   }
   if (! S_ISREG (sbuf.st_mode))
@@ -925,6 +926,7 @@ import_key (void *cls,
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "File `%s' is not a regular file, which is not allowed for 
private keys!\n",
                 filename);
+    GNUNET_break (0 == close (fd));
     return GNUNET_OK;
   }
   if (0 != (sbuf.st_mode & (S_IWUSR | S_IRWXG | S_IRWXO)))
diff --git a/src/util/taler-exchange-secmod-rsa.c 
b/src/util/taler-exchange-secmod-rsa.c
index 670804e7..713c3498 100644
--- a/src/util/taler-exchange-secmod-rsa.c
+++ b/src/util/taler-exchange-secmod-rsa.c
@@ -628,8 +628,8 @@ sem_up (struct Semaphore *sem)
 static void
 sem_done (struct Semaphore *sem)
 {
-  pthread_cond_destroy (&sem->cv);
-  pthread_mutex_destroy (&sem->mutex);
+  GNUNET_break (0 == pthread_cond_destroy (&sem->cv));
+  GNUNET_break (0 == pthread_mutex_destroy (&sem->mutex));
 }
 
 
@@ -1625,6 +1625,7 @@ import_key (void *cls,
     GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
                               "stat",
                               filename);
+    GNUNET_break (0 == close (fd));
     return GNUNET_OK;
   }
   if (! S_ISREG (sbuf.st_mode))

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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