fix misc. memory leaks

This commit is contained in:
Christian Grothoff 2018-11-25 14:51:31 +01:00
parent 5052698cbc
commit 85aa6d17c7
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
5 changed files with 23 additions and 7 deletions

View File

@ -314,16 +314,19 @@ handle_version (struct TAH_RequestHandler *rh,
const char *upload_data, const char *upload_data,
size_t *upload_data_size) 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) rh;
(void) upload_data; (void) upload_data;
(void) upload_data_size; (void) upload_data_size;
(void) connection_cls; (void) connection_cls;
if (NULL == ver)
{
ver = json_pack ("{s:s, s:s, s:o}", ver = json_pack ("{s:s, s:s, s:o}",
"version", AUDITOR_PROTOCOL_VERSION, "version", AUDITOR_PROTOCOL_VERSION,
"currency", currency, "currency", currency,
"auditor_public_key", GNUNET_JSON_from_data_auto (&auditor_pub)); "auditor_public_key", GNUNET_JSON_from_data_auto (&auditor_pub));
}
if (NULL == ver) if (NULL == ver)
{ {
GNUNET_break (0); GNUNET_break (0);
@ -616,8 +619,10 @@ auditor_serve_process_config ()
GNUNET_free (auditor_key_file); GNUNET_free (auditor_key_file);
return 1; return 1;
} }
GNUNET_free (auditor_key_file);
GNUNET_CRYPTO_eddsa_key_get_public (eddsa_priv, GNUNET_CRYPTO_eddsa_key_get_public (eddsa_priv,
&auditor_pub.eddsa_pub); &auditor_pub.eddsa_pub);
GNUNET_free (eddsa_priv);
} }
else else
{ {

View File

@ -66,6 +66,7 @@ TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
{ {
case TALER_BANK_AUTH_NONE: case TALER_BANK_AUTH_NONE:
auth->method = TALER_BANK_AUTH_NONE; auth->method = TALER_BANK_AUTH_NONE;
GNUNET_free (method);
return GNUNET_OK; return GNUNET_OK;
case TALER_BANK_AUTH_BASIC: case TALER_BANK_AUTH_BASIC:
if (GNUNET_OK != 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, GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
section, section,
"USERNAME"); "USERNAME");
GNUNET_free (method);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (GNUNET_OK != 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, GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
section, section,
"USERNAME"); "USERNAME");
GNUNET_free (method);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
auth->method = TALER_BANK_AUTH_BASIC; auth->method = TALER_BANK_AUTH_BASIC;
GNUNET_free (method);
return GNUNET_OK; return GNUNET_OK;
} }
} }
} }
GNUNET_free (method);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }

View File

@ -97,6 +97,7 @@ batch_cleanup (void *cls,
bs->batch[i].cleanup (bs->batch[i].cls, bs->batch[i].cleanup (bs->batch[i].cls,
&bs->batch[i]); &bs->batch[i]);
GNUNET_free_non_null (bs->batch); GNUNET_free_non_null (bs->batch);
GNUNET_free (bs);
} }

View File

@ -465,6 +465,7 @@ refresh_reveal_cleanup (void *cls,
GNUNET_free_non_null (rrs->fresh_coins); GNUNET_free_non_null (rrs->fresh_coins);
rrs->fresh_coins = NULL; rrs->fresh_coins = NULL;
rrs->num_fresh_coins = 0; rrs->num_fresh_coins = 0;
GNUNET_free (rrs);
} }
@ -765,6 +766,7 @@ refresh_link_cleanup (void *cls,
GNUNET_SCHEDULER_cancel (rls->retry_task); GNUNET_SCHEDULER_cancel (rls->retry_task);
rls->retry_task = NULL; rls->retry_task = NULL;
} }
GNUNET_free (rls);
} }
@ -1036,6 +1038,7 @@ refresh_melt_cleanup (void *cls,
GNUNET_free_non_null (rms->refresh_data); GNUNET_free_non_null (rms->refresh_data);
rms->refresh_data = NULL; rms->refresh_data = NULL;
rms->refresh_data_length = 0; rms->refresh_data_length = 0;
GNUNET_free (rms);
} }

View File

@ -578,6 +578,7 @@ taler_bank_prepare_wire_transfer (void *cls,
GNUNET_free (a_in.bank_base_url); GNUNET_free (a_in.bank_base_url);
GNUNET_free (a_out.hostname); GNUNET_free (a_out.hostname);
GNUNET_free (a_out.bank_base_url); GNUNET_free (a_out.bank_base_url);
GNUNET_free (origin_account_url);
return NULL; return NULL;
} }
GNUNET_free (a_in.hostname); GNUNET_free (a_in.hostname);
@ -592,6 +593,7 @@ taler_bank_prepare_wire_transfer (void *cls,
&pth->auth)) &pth->auth))
{ {
GNUNET_free (pth); GNUNET_free (pth);
GNUNET_free (origin_account_url);
return NULL; return NULL;
} }