From a08b70f6244fafa2664f694cf28c0e3d128a9a0b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 28 Jan 2024 23:27:32 +0100 Subject: -fix misc. leaks --- src/backend/taler-merchant-httpd_private-post-instances.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/backend/taler-merchant-httpd_private-post-instances.c') diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c index 396008c8..a4cf884d 100644 --- a/src/backend/taler-merchant-httpd_private-post-instances.c +++ b/src/backend/taler-merchant-httpd_private-post-instances.c @@ -49,7 +49,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, struct MHD_Connection *connection, struct TMH_HandlerContext *hc) { - struct TALER_MERCHANTDB_InstanceSettings is; + struct TALER_MERCHANTDB_InstanceSettings is = { 0 }; struct TALER_MERCHANTDB_InstanceAuthSettings ias; const char *auth_token = NULL; const char *uts = "business"; @@ -110,6 +110,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, &is.ut)) { 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, @@ -123,7 +124,10 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, jauth, &auth_token); if (GNUNET_OK != ret) + { + GNUNET_JSON_parse_free (spec); return (GNUNET_NO == ret) ? MHD_YES : MHD_NO; + } } /* check 'id' well-formed */ @@ -146,15 +150,19 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, 0, NULL, 0)) id_wellformed = false; if (! id_wellformed) + { + GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_GENERIC_PARAMETER_MALFORMED, "id"); + } } if (! TMH_location_object_valid (is.address)) { 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, @@ -164,6 +172,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, if (! TMH_location_object_valid (is.jurisdiction)) { 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, @@ -174,6 +183,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, (! TMH_image_data_url_valid (is.logo)) ) { 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, @@ -189,6 +199,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, { if (mi->deleted) { + GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, MHD_HTTP_CONFLICT, TALER_EC_MERCHANT_PRIVATE_POST_INSTANCES_PURGE_REQUIRED, @@ -231,12 +242,14 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, ==, is.default_pay_delay)) ) { + GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_static (connection, MHD_HTTP_NO_CONTENT, NULL, NULL, 0); } + GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error (connection, MHD_HTTP_CONFLICT, TALER_EC_MERCHANT_PRIVATE_POST_INSTANCES_ALREADY_EXISTS, -- cgit v1.2.3