diff options
author | Florian Dold <florian@dold.me> | 2024-11-05 14:31:37 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2024-11-05 14:31:37 +0100 |
commit | 5a0ba5e96c5e0637f42c36ead0e6233c7e82b5f7 (patch) | |
tree | cee5a9d849b498e285605ce84c0f5dfa13a7f97b | |
parent | 833ed97bbc41fa62b9d611d28f0bdf840ea1c926 (diff) |
fix missing return and memory leaks
-rw-r--r-- | src/exchange/taler-exchange-httpd_common_kyc.c | 27 | ||||
-rw-r--r-- | src/exchange/taler-exchange-httpd_kyc-info.c | 1 |
2 files changed, 12 insertions, 16 deletions
diff --git a/src/exchange/taler-exchange-httpd_common_kyc.c b/src/exchange/taler-exchange-httpd_common_kyc.c index 42d771220..7672900d3 100644 --- a/src/exchange/taler-exchange-httpd_common_kyc.c +++ b/src/exchange/taler-exchange-httpd_common_kyc.c @@ -1709,7 +1709,7 @@ legitimization_check_run ( "KYC: merchant_pub does not match target_pub of custom rules!\n"); json_decref (jrules); fail_kyc_auth (lch); - return; + goto cleanup; } } @@ -1758,6 +1758,7 @@ legitimization_check_run ( { run_check (lch, &kcc); + goto cleanup; } } } @@ -1772,19 +1773,17 @@ legitimization_check_run ( if (qs < 0) { GNUNET_break (0); - TALER_KYCLOGIC_rules_free (lrs); legi_fail (lch, TALER_EC_GENERIC_DB_FETCH_FAILED, "kyc_test_required"); - GNUNET_async_scope_restore (&old_scope); - return; + goto cleanup; } if (lch->lcr.bad_kyc_auth) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "KYC auth required\n"); fail_kyc_auth (lch); - return; + goto cleanup; } if (NULL == requirement) @@ -1803,8 +1802,7 @@ legitimization_check_run ( = GNUNET_SCHEDULER_add_now ( &async_return_legi_result, lch); - GNUNET_async_scope_restore (&old_scope); - return; + goto cleanup; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -1844,11 +1842,9 @@ legitimization_check_run ( legi_fail (lch, TALER_EC_EXCHANGE_KYC_AML_PROGRAM_FAILURE, NULL); - GNUNET_async_scope_restore (&old_scope); - return; + goto cleanup; } - GNUNET_async_scope_restore (&old_scope); - return; + goto cleanup; } /* No instant measure, store all measures in the database and @@ -1884,24 +1880,23 @@ legitimization_check_run ( legi_fail (lch, TALER_EC_GENERIC_INTERNAL_INVARIANT_FAILURE, "trigger_kyc_rule_for_account"); - GNUNET_async_scope_restore (&old_scope); - return; + goto cleanup; } - TALER_KYCLOGIC_rules_free (lrs); if (GNUNET_DB_STATUS_HARD_ERROR == qs) { GNUNET_break (0); legi_fail (lch, TALER_EC_GENERIC_DB_STORE_FAILED, "trigger_kyc_rule_for_account"); - GNUNET_async_scope_restore (&old_scope); - return; + goto cleanup; } /* return success! */ lch->async_task = GNUNET_SCHEDULER_add_now ( &async_return_legi_result, lch); +cleanup: + TALER_KYCLOGIC_rules_free (lrs); GNUNET_async_scope_restore (&old_scope); } diff --git a/src/exchange/taler-exchange-httpd_kyc-info.c b/src/exchange/taler-exchange-httpd_kyc-info.c index 857306479..1309b10f8 100644 --- a/src/exchange/taler-exchange-httpd_kyc-info.c +++ b/src/exchange/taler-exchange-httpd_kyc-info.c @@ -613,6 +613,7 @@ TEH_handler_kyc_info ( MHD_suspend_connection (rc->connection); return MHD_YES; } + /* FIXME: We should instead long-poll on the running KYC program. */ if (contains_instant_measure (jmeasures)) { json_decref (jmeasures); |