aboutsummaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_aml-decision.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-06-04 13:26:00 +0200
committerChristian Grothoff <christian@grothoff.org>2023-06-04 13:26:00 +0200
commit809300158caaa0215c36ef89c7e38f0edfa93593 (patch)
tree1faf7e314af34db7a2333d8003ee0ed6fca91d74 /src/exchange/taler-exchange-httpd_aml-decision.c
parent9718bc4920ab4781378b777bf3e2af275c8d0575 (diff)
code cleanup, fixing misc. memory leaks in the process
Diffstat (limited to 'src/exchange/taler-exchange-httpd_aml-decision.c')
-rw-r--r--src/exchange/taler-exchange-httpd_aml-decision.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/exchange/taler-exchange-httpd_aml-decision.c b/src/exchange/taler-exchange-httpd_aml-decision.c
index 2830e54e..c1439adc 100644
--- a/src/exchange/taler-exchange-httpd_aml-decision.c
+++ b/src/exchange/taler-exchange-httpd_aml-decision.c
@@ -74,7 +74,7 @@ struct DecisionContext
/**
* KYC requirements imposed, NULL for none.
*/
- json_t *kyc_requirements;
+ const json_t *kyc_requirements;
};
@@ -261,8 +261,8 @@ TEH_handler_post_aml_decision (
GNUNET_JSON_spec_uint32 ("new_state",
&new_state32),
GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_json ("kyc_requirements",
- &dc.kyc_requirements),
+ GNUNET_JSON_spec_array_const ("kyc_requirements",
+ &dc.kyc_requirements),
NULL),
GNUNET_JSON_spec_end ()
};
@@ -306,17 +306,6 @@ TEH_handler_post_aml_decision (
size_t index;
json_t *elem;
- if (! json_is_array (dc.kyc_requirements))
- {
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PARAMETER_MALFORMED,
- "kyc_requirements must be an array");
- }
-
json_array_foreach (dc.kyc_requirements, index, elem)
{
const char *val;
@@ -324,7 +313,6 @@ TEH_handler_post_aml_decision (
if (! json_is_string (elem))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_BAD_REQUEST,
@@ -336,7 +324,6 @@ TEH_handler_post_aml_decision (
TALER_KYCLOGIC_check_satisfiable (val))
{
GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_BAD_REQUEST,
@@ -357,11 +344,9 @@ TEH_handler_post_aml_decision (
&make_aml_decision,
&dc))
{
- GNUNET_JSON_parse_free (spec);
return mhd_ret;
}
}
- GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_static (
connection,
MHD_HTTP_NO_CONTENT,