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,
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
{

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}