fix a few more leaks

This commit is contained in:
Christian Grothoff 2018-11-25 15:38:58 +01:00
parent 85aa6d17c7
commit f224017505
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 39 additions and 6 deletions

View File

@ -1 +1,4 @@
test_auditor_api test_auditor_api
test_exchange_api_home/.local/share/taler/auditors/
test_exchange_api_home/.local/share/taler/exchange/live-keys/
auditor.in

View File

@ -250,6 +250,20 @@ refresh_reveal_preflight (void *cls,
} }
/**
* Helper function for #refresh_reveal_transaction() to free internal
* state of @a refresh_melt (but not the pointer itself!).
*
* @param refresh_melt memory to clean up
*/
static void
free_refresh_melt (struct TALER_EXCHANGEDB_RefreshMelt *refresh_melt)
{
GNUNET_CRYPTO_rsa_signature_free (refresh_melt->session.coin.denom_sig.rsa_signature);
GNUNET_CRYPTO_rsa_public_key_free (refresh_melt->session.coin.denom_pub.rsa_public_key);
}
/** /**
* Execute a "/refresh/reveal". The client is revealing to us the * Execute a "/refresh/reveal". The client is revealing to us the
* transfer keys for @a #TALER_CNC_KAPPA-1 sets of coins. Verify that the * transfer keys for @a #TALER_CNC_KAPPA-1 sets of coins. Verify that the
@ -299,6 +313,8 @@ refresh_reveal_transaction (void *cls,
GNUNET_break (0); GNUNET_break (0);
*mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection, *mhd_ret = TEH_RESPONSE_reply_internal_db_error (connection,
TALER_EC_REFRESH_REVEAL_DB_FETCH_SESSION_ERROR); TALER_EC_REFRESH_REVEAL_DB_FETCH_SESSION_ERROR);
if (refresh_melt.session.noreveal_index >= TALER_CNC_KAPPA)
free_refresh_melt (&refresh_melt);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
@ -385,6 +401,7 @@ refresh_reveal_transaction (void *cls,
GNUNET_break_op (0); GNUNET_break_op (0);
*mhd_ret = reply_refresh_reveal_missmatch (connection, *mhd_ret = reply_refresh_reveal_missmatch (connection,
&rc_expected); &rc_expected);
free_refresh_melt (&refresh_melt);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
} /* end of checking "rc_expected" */ } /* end of checking "rc_expected" */
@ -417,6 +434,7 @@ refresh_reveal_transaction (void *cls,
*mhd_ret = TEH_RESPONSE_reply_internal_error (connection, *mhd_ret = TEH_RESPONSE_reply_internal_error (connection,
TALER_EC_REFRESH_REVEAL_COST_CALCULATION_OVERFLOW, TALER_EC_REFRESH_REVEAL_COST_CALCULATION_OVERFLOW,
"failed to add up refresh costs"); "failed to add up refresh costs");
free_refresh_melt (&refresh_melt);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
} }
@ -427,9 +445,11 @@ refresh_reveal_transaction (void *cls,
*mhd_ret = TEH_RESPONSE_reply_external_error (connection, *mhd_ret = TEH_RESPONSE_reply_external_error (connection,
TALER_EC_REFRESH_REVEAL_AMOUNT_INSUFFICIENT, TALER_EC_REFRESH_REVEAL_AMOUNT_INSUFFICIENT,
"melted coin value is insufficient to cover cost of operation"); "melted coin value is insufficient to cover cost of operation");
free_refresh_melt (&refresh_melt);
return GNUNET_DB_STATUS_HARD_ERROR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
} }
free_refresh_melt (&refresh_melt);
return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS;
} }

View File

@ -90,7 +90,8 @@ common_free_coin_transaction_list (void *cls,
switch (list->type) switch (list->type)
{ {
case TALER_EXCHANGEDB_TT_DEPOSIT: case TALER_EXCHANGEDB_TT_DEPOSIT:
GNUNET_free_non_null (list->details.deposit->receiver_wire_account); if (NULL != list->details.deposit->receiver_wire_account)
json_decref (list->details.deposit->receiver_wire_account);
if (NULL != list->details.deposit->coin.denom_pub.rsa_public_key) if (NULL != list->details.deposit->coin.denom_pub.rsa_public_key)
GNUNET_CRYPTO_rsa_public_key_free (list->details.deposit->coin.denom_pub.rsa_public_key); GNUNET_CRYPTO_rsa_public_key_free (list->details.deposit->coin.denom_pub.rsa_public_key);
if (NULL != list->details.deposit->coin.denom_sig.rsa_signature) if (NULL != list->details.deposit->coin.denom_sig.rsa_signature)

View File

@ -253,11 +253,10 @@ parse_payto (const char *account_url,
} }
GNUNET_free (s); GNUNET_free (s);
} }
else else if (1 != sscanf (account,
{
if (1 != sscanf (account,
"%llu", "%llu",
&no)) &no))
{
return TALER_EC_PAYTO_MALFORMED; return TALER_EC_PAYTO_MALFORMED;
} }
if (no > MAX_ACCOUNT_NO) if (no > MAX_ACCOUNT_NO)
@ -773,6 +772,8 @@ taler_bank_execute_wire_transfer (void *cls,
parse_payto (destination_account_url, parse_payto (destination_account_url,
&destination_account)) &destination_account))
{ {
GNUNET_free_non_null (origin_account.hostname);
GNUNET_free_non_null (origin_account.bank_base_url);
GNUNET_break (0); GNUNET_break (0);
return NULL; return NULL;
} }
@ -780,6 +781,10 @@ taler_bank_execute_wire_transfer (void *cls,
destination_account.hostname)) destination_account.hostname))
{ {
GNUNET_break (0); GNUNET_break (0);
GNUNET_free_non_null (origin_account.hostname);
GNUNET_free_non_null (destination_account.hostname);
GNUNET_free_non_null (origin_account.bank_base_url);
GNUNET_free_non_null (destination_account.bank_base_url);
return NULL; return NULL;
} }
@ -798,6 +803,10 @@ taler_bank_execute_wire_transfer (void *cls,
(uint64_t) destination_account.no, (uint64_t) destination_account.no,
&execute_cb, &execute_cb,
eh); eh);
GNUNET_free_non_null (origin_account.bank_base_url);
GNUNET_free_non_null (destination_account.bank_base_url);
GNUNET_free_non_null (origin_account.hostname);
GNUNET_free_non_null (destination_account.hostname);
GNUNET_free (wire_s); GNUNET_free (wire_s);
if (NULL == eh->aaih) if (NULL == eh->aaih)
{ {