diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-02-17 16:57:29 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-02-17 16:57:29 +0100 |
commit | 86e0f2c70d07c7c5e1656667bd818498ea55d0a4 (patch) | |
tree | dba9439c62d1b017319d9e313a82b33ea6c68187 /src/exchange/taler-exchange-httpd_withdraw.c | |
parent | 87a78c6f8ce1d50a5f61eb5c3f222cdef0b635ee (diff) |
fix memory leak and transaction error handling related to KYC
Diffstat (limited to 'src/exchange/taler-exchange-httpd_withdraw.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_withdraw.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c index 40cefc7d..9560e7dc 100644 --- a/src/exchange/taler-exchange-httpd_withdraw.c +++ b/src/exchange/taler-exchange-httpd_withdraw.c @@ -288,7 +288,7 @@ withdraw_transaction (void *cls, is required as the merge already did that. */ if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs) { - const char *kyc_required; + char *kyc_required; qs = TALER_KYCLOGIC_kyc_test_required ( TALER_KYCLOGIC_KYC_TRIGGER_WITHDRAW, @@ -314,11 +314,21 @@ withdraw_transaction (void *cls, { /* insert KYC requirement into DB! */ wc->kyc.ok = false; - return TEH_plugin->insert_kyc_requirement_for_account ( + qs = TEH_plugin->insert_kyc_requirement_for_account ( TEH_plugin->cls, kyc_required, &wc->h_account_payto, &wc->kyc.requirement_row); + GNUNET_free (kyc_required); + if (GNUNET_DB_STATUS_HARD_ERROR == qs) + { + GNUNET_break (0); + *mhd_ret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_INTERNAL_SERVER_ERROR, + TALER_EC_GENERIC_DB_STORE_FAILED, + "insert_kyc_requirement_for_account"); + } + return qs; } } wc->kyc.ok = true; |