summaryrefslogtreecommitdiff
path: root/src/backend/taler-merchant-httpd_private-post-instances.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-01-28 23:27:32 +0100
committerChristian Grothoff <christian@grothoff.org>2024-01-28 23:27:32 +0100
commita08b70f6244fafa2664f694cf28c0e3d128a9a0b (patch)
tree68dc5ff4bc1c2b25a8c6a1686a066de52bc1f38e /src/backend/taler-merchant-httpd_private-post-instances.c
parent914f6391fe7b61d441a8dcf284844bfd46f9abee (diff)
downloadmerchant-a08b70f6244fafa2664f694cf28c0e3d128a9a0b.tar.gz
merchant-a08b70f6244fafa2664f694cf28c0e3d128a9a0b.tar.bz2
merchant-a08b70f6244fafa2664f694cf28c0e3d128a9a0b.zip
-fix misc. leaks
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-post-instances.c')
-rw-r--r--src/backend/taler-merchant-httpd_private-post-instances.c15
1 files changed, 14 insertions, 1 deletions
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,