aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-11-25 14:51:31 +0100
committerChristian Grothoff <christian@grothoff.org>2018-11-25 14:51:31 +0100
commit85aa6d17c727a5899490aa82b0ece9ac95972c66 (patch)
tree166a80ac1f86a7732b8d502f2b9070b4d57e33f7
parent5052698cbc6692c922e75081af12ad24bf8c3e69 (diff)
fix misc. memory leaks
-rw-r--r--src/auditor/taler-auditor-httpd.c15
-rw-r--r--src/bank-lib/bank_api_parse.c5
-rw-r--r--src/exchange-lib/testing_api_cmd_batch.c1
-rw-r--r--src/exchange-lib/testing_api_cmd_refresh.c3
-rw-r--r--src/wire-plugins/plugin_wire_taler-bank.c6
5 files changed, 23 insertions, 7 deletions
diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c
index 5e1d1b169..c7c2589c6 100644
--- a/src/auditor/taler-auditor-httpd.c
+++ b/src/auditor/taler-auditor-httpd.c
@@ -314,16 +314,19 @@ handle_version (struct TAH_RequestHandler *rh,
const char *upload_data,
size_t *upload_data_size)
{
- json_t *ver;
+ static json_t *ver; /* we build the response only once, keep around for next query! */
(void) rh;
(void) upload_data;
(void) upload_data_size;
(void) connection_cls;
- ver = json_pack ("{s:s, s:s, s:o}",
- "version", AUDITOR_PROTOCOL_VERSION,
- "currency", currency,
- "auditor_public_key", GNUNET_JSON_from_data_auto (&auditor_pub));
+ if (NULL == ver)
+ {
+ ver = json_pack ("{s:s, s:s, s:o}",
+ "version", AUDITOR_PROTOCOL_VERSION,
+ "currency", currency,
+ "auditor_public_key", GNUNET_JSON_from_data_auto (&auditor_pub));
+ }
if (NULL == ver)
{
GNUNET_break (0);
@@ -616,8 +619,10 @@ auditor_serve_process_config ()
GNUNET_free (auditor_key_file);
return 1;
}
+ GNUNET_free (auditor_key_file);
GNUNET_CRYPTO_eddsa_key_get_public (eddsa_priv,
&auditor_pub.eddsa_pub);
+ GNUNET_free (eddsa_priv);
}
else
{
diff --git a/src/bank-lib/bank_api_parse.c b/src/bank-lib/bank_api_parse.c
index 04cf7b85f..6de9e5e1c 100644
--- a/src/bank-lib/bank_api_parse.c
+++ b/src/bank-lib/bank_api_parse.c
@@ -66,6 +66,7 @@ TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
{
case TALER_BANK_AUTH_NONE:
auth->method = TALER_BANK_AUTH_NONE;
+ GNUNET_free (method);
return GNUNET_OK;
case TALER_BANK_AUTH_BASIC:
if (GNUNET_OK !=
@@ -77,6 +78,7 @@ TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
section,
"USERNAME");
+ GNUNET_free (method);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
@@ -90,13 +92,16 @@ TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
section,
"USERNAME");
+ GNUNET_free (method);
return GNUNET_SYSERR;
}
auth->method = TALER_BANK_AUTH_BASIC;
+ GNUNET_free (method);
return GNUNET_OK;
}
}
}
+ GNUNET_free (method);
return GNUNET_SYSERR;
}
diff --git a/src/exchange-lib/testing_api_cmd_batch.c b/src/exchange-lib/testing_api_cmd_batch.c
index 5269d0b8b..15b0413d7 100644
--- a/src/exchange-lib/testing_api_cmd_batch.c
+++ b/src/exchange-lib/testing_api_cmd_batch.c
@@ -97,6 +97,7 @@ batch_cleanup (void *cls,
bs->batch[i].cleanup (bs->batch[i].cls,
&bs->batch[i]);
GNUNET_free_non_null (bs->batch);
+ GNUNET_free (bs);
}
diff --git a/src/exchange-lib/testing_api_cmd_refresh.c b/src/exchange-lib/testing_api_cmd_refresh.c
index 50ea46785..85c1f8c95 100644
--- a/src/exchange-lib/testing_api_cmd_refresh.c
+++ b/src/exchange-lib/testing_api_cmd_refresh.c
@@ -465,6 +465,7 @@ refresh_reveal_cleanup (void *cls,
GNUNET_free_non_null (rrs->fresh_coins);
rrs->fresh_coins = NULL;
rrs->num_fresh_coins = 0;
+ GNUNET_free (rrs);
}
@@ -765,6 +766,7 @@ refresh_link_cleanup (void *cls,
GNUNET_SCHEDULER_cancel (rls->retry_task);
rls->retry_task = NULL;
}
+ GNUNET_free (rls);
}
@@ -1036,6 +1038,7 @@ refresh_melt_cleanup (void *cls,
GNUNET_free_non_null (rms->refresh_data);
rms->refresh_data = NULL;
rms->refresh_data_length = 0;
+ GNUNET_free (rms);
}
diff --git a/src/wire-plugins/plugin_wire_taler-bank.c b/src/wire-plugins/plugin_wire_taler-bank.c
index 029380fb4..6075b25a0 100644
--- a/src/wire-plugins/plugin_wire_taler-bank.c
+++ b/src/wire-plugins/plugin_wire_taler-bank.c
@@ -280,7 +280,7 @@ parse_payto (const char *account_url,
"%llu",
&port))
{
- GNUNET_break (0);
+ GNUNET_break (0);
TALER_LOG_ERROR ("Malformed host from payto:// URI\n");
GNUNET_free (r_account->hostname);
return TALER_EC_PAYTO_MALFORMED;
@@ -300,7 +300,7 @@ parse_payto (const char *account_url,
(GNUNET_SYSERR != GNUNET_asprintf
(&r_account->bank_base_url,
"https://%s",
- r_account->hostname));
+ r_account->hostname));
}
}
return TALER_EC_NONE;
@@ -578,6 +578,7 @@ taler_bank_prepare_wire_transfer (void *cls,
GNUNET_free (a_in.bank_base_url);
GNUNET_free (a_out.hostname);
GNUNET_free (a_out.bank_base_url);
+ GNUNET_free (origin_account_url);
return NULL;
}
GNUNET_free (a_in.hostname);
@@ -592,6 +593,7 @@ taler_bank_prepare_wire_transfer (void *cls,
&pth->auth))
{
GNUNET_free (pth);
+ GNUNET_free (origin_account_url);
return NULL;
}