gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-exchange] branch master updated (ad850ce -> 4694810)


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated (ad850ce -> 4694810)
Date: Sun, 04 Jun 2017 12:18:10 +0200

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

grothoff pushed a change to branch master
in repository exchange.

    from ad850ce  ignore generated file
     new 59fd83b  fix memory leaks (#5050)
     new 4694810  free auditor data on shutdown (#5050)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitignore                              |  1 +
 Makefile.am                             |  2 +
 src/bank-lib/fakebank.c                 |  1 +
 src/exchange-lib/exchange_api_handle.c  | 11 ++++--
 src/exchange-lib/exchange_api_reserve.c | 68 ++++++++++++++++++++++++++-------
 src/include/taler_exchange_service.h    |  2 +-
 6 files changed, 67 insertions(+), 18 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7f0c79e..4b4c412 100644
--- a/.gitignore
+++ b/.gitignore
@@ -84,3 +84,4 @@ doc/manual/manual.toc
 doc/manual/manual.tp
 doc/manual/manual.vr
 contrib/taler-exchange.tag
+doxygen-doc/
diff --git a/Makefile.am b/Makefile.am
index a73d4d8..ab0f3ac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,6 +13,8 @@ ACLOCAL_AMFLAGS = -I m4
 EXTRA_DIST = \
   AUTHORS \
   contrib/coverage.sh \
+  contrib/gnunet.tag \
+  contrib/microhttpd.tag \
   Doxyfile
 
 app:
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index 924e065..ceda4d3 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -361,6 +361,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
                       (json_int_t) t->serial_id);
     json_str = json_dumps (json,
                            JSON_INDENT(2));
+    json_decref (json);
     if (NULL == json_str)
     {
       GNUNET_break (0);
diff --git a/src/exchange-lib/exchange_api_handle.c 
b/src/exchange-lib/exchange_api_handle.c
index 6ed868f..40e5107 100644
--- a/src/exchange-lib/exchange_api_handle.c
+++ b/src/exchange-lib/exchange_api_handle.c
@@ -634,16 +634,21 @@ decode_keys_json (const json_t *resp_obj,
 static void
 free_key_data (struct TALER_EXCHANGE_Keys *key_data)
 {
-  unsigned int i;
-
   GNUNET_array_grow (key_data->sign_keys,
                      key_data->num_sign_keys,
                      0);
-  for (i=0;i<key_data->num_denom_keys;i++)
+  for (unsigned int i=0;i<key_data->num_denom_keys;i++)
     GNUNET_CRYPTO_rsa_public_key_free 
(key_data->denom_keys[i].key.rsa_public_key);
   GNUNET_array_grow (key_data->denom_keys,
                      key_data->num_denom_keys,
                      0);
+  for (unsigned int i=0;i<key_data->num_auditors;i++)
+  {
+    GNUNET_array_grow (key_data->auditors[i].denom_keys,
+                       key_data->auditors[i].num_denom_keys,
+                       0);
+    GNUNET_free (key_data->auditors[i].auditor_url);
+  }
   GNUNET_array_grow (key_data->auditors,
                      key_data->num_auditors,
                      0);
diff --git a/src/exchange-lib/exchange_api_reserve.c 
b/src/exchange-lib/exchange_api_reserve.c
index 7649ccc..c7b486f 100644
--- a/src/exchange-lib/exchange_api_reserve.c
+++ b/src/exchange-lib/exchange_api_reserve.c
@@ -409,12 +409,43 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle 
*exchange,
     GNUNET_break_op (0);
     return GNUNET_SYSERR;
   }
-
   return GNUNET_OK;
 }
 
 
 /**
+ * Free memory (potentially) allocated by #parse_reserve_history().
+ *
+ * @param rhistory result to free
+ * @param len number of entries in @a rhistory
+ */
+static void
+free_rhistory (struct TALER_EXCHANGE_ReserveHistory *rhistory,
+               unsigned int len)
+{
+  for (unsigned int i=0;i<len;i++)
+  {
+    switch (rhistory[i].type)
+    {
+    case TALER_EXCHANGE_RTT_DEPOSIT:
+      GNUNET_free_non_null (rhistory[i].details.in_details.wire_reference);
+      if (NULL != rhistory[i].details.in_details.sender_account_details)
+        json_decref (rhistory[i].details.in_details.sender_account_details);
+      break;
+    case TALER_EXCHANGE_RTT_WITHDRAWAL:
+      break;
+    case TALER_EXCHANGE_RTT_PAYBACK:
+      break;
+    case TALER_EXCHANGE_RTT_CLOSE:
+      if (NULL != rhistory[i].details.close_details.receiver_account_details)
+        json_decref 
(rhistory[i].details.close_details.receiver_account_details);
+      break;
+    }
+  }
+}
+
+
+/**
  * Function called when we're done processing the
  * HTTP /reserve/status request.
  *
@@ -468,6 +499,7 @@ handle_reserve_status_finished (void *cls,
       {
         struct TALER_EXCHANGE_ReserveHistory rhistory[len];
 
+        memset (rhistory, 0, sizeof (rhistory));
         if (GNUNET_OK !=
             parse_reserve_history (rsh->exchange,
                                    history,
@@ -479,25 +511,29 @@ handle_reserve_status_finished (void *cls,
         {
           GNUNET_break_op (0);
           response_code = 0;
-          break;
         }
-        if (0 !=
-            TALER_amount_cmp (&balance_from_history,
-                              &balance))
+        if ( (0 != response_code) &&
+             (0 !=
+              TALER_amount_cmp (&balance_from_history,
+                                &balance)) )
         {
           /* exchange cannot add up balances!? */
           GNUNET_break_op (0);
           response_code = 0;
-          break;
         }
-        rsh->cb (rsh->cb_cls,
-                 response_code,
-                TALER_EC_NONE,
-                 json,
-                 &balance,
-                 len,
-                 rhistory);
-        rsh->cb = NULL;
+        if (0 != response_code)
+        {
+          rsh->cb (rsh->cb_cls,
+                   response_code,
+                   TALER_EC_NONE,
+                   json,
+                   &balance,
+                   len,
+                   rhistory);
+          rsh->cb = NULL;
+        }
+        free_rhistory (rhistory,
+                       len);
       }
     }
     break;
@@ -796,8 +832,12 @@ reserve_withdraw_payment_required (struct 
TALER_EXCHANGE_ReserveWithdrawHandle *
                                rhistory))
     {
       GNUNET_break_op (0);
+      free_rhistory (rhistory,
+                     len);
       return GNUNET_SYSERR;
     }
+    free_rhistory (rhistory,
+                   len);
   }
 
   if (0 !=
diff --git a/src/include/taler_exchange_service.h 
b/src/include/taler_exchange_service.h
index 7114aa6..9a004a4 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -154,7 +154,7 @@ struct TALER_EXCHANGE_AuditorInformation
    * should also be an auditor API for automated submission about
    * claims of misbehaving exchange providers.
    */
-  const char *auditor_url;
+  char *auditor_url;
 
   /**
    * Number of denomination keys audited by this auditor.

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



reply via email to

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