summaryrefslogtreecommitdiff
path: root/src/backend
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
parent914f6391fe7b61d441a8dcf284844bfd46f9abee (diff)
downloadmerchant-a08b70f6244fafa2664f694cf28c0e3d128a9a0b.tar.gz
merchant-a08b70f6244fafa2664f694cf28c0e3d128a9a0b.tar.bz2
merchant-a08b70f6244fafa2664f694cf28c0e3d128a9a0b.zip
-fix misc. leaks
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd_private-patch-token-families-SLUG.c12
-rw-r--r--src/backend/taler-merchant-httpd_private-post-instances.c15
-rw-r--r--src/backend/taler-merchant-httpd_private-post-orders.c12
-rw-r--r--src/backend/taler-merchant-httpd_private-post-token-families.c9
4 files changed, 33 insertions, 15 deletions
diff --git a/src/backend/taler-merchant-httpd_private-patch-token-families-SLUG.c b/src/backend/taler-merchant-httpd_private-patch-token-families-SLUG.c
index 8d34b2ff..c49d80d7 100644
--- a/src/backend/taler-merchant-httpd_private-patch-token-families-SLUG.c
+++ b/src/backend/taler-merchant-httpd_private-patch-token-families-SLUG.c
@@ -82,7 +82,7 @@ TMH_private_patch_token_family_SLUG (const struct TMH_RequestHandler *rh,
: MHD_NO;
}
- struct GNUNET_TIME_Relative validity = GNUNET_TIME_absolute_get_difference(
+ struct GNUNET_TIME_Relative validity = GNUNET_TIME_absolute_get_difference (
details.valid_after.abs_time,
details.valid_before.abs_time);
@@ -98,8 +98,10 @@ TMH_private_patch_token_family_SLUG (const struct TMH_RequestHandler *rh,
}
if (NULL == details.description_i18n)
+ {
details.description_i18n = json_object ();
-
+ GNUNET_assert (NULL != details.description_i18n);
+ }
if (! TALER_JSON_check_i18n (details.description_i18n))
{
GNUNET_break_op (0);
@@ -136,9 +138,9 @@ TMH_private_patch_token_family_SLUG (const struct TMH_RequestHandler *rh,
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
// TODO: Add error code for token family not found
ret = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_NOT_FOUND,
- 0,
- slug);
+ MHD_HTTP_NOT_FOUND,
+ 0,
+ slug);
break;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
ret = TALER_MHD_reply_static (connection,
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,
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c
index 52c146ef..3c3f9ab8 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -1851,6 +1851,7 @@ parse_order (struct OrderContext *oc)
if (NULL != loca)
{
loca = json_deep_copy (loca);
+ GNUNET_assert (NULL != loca);
GNUNET_assert (0 ==
json_object_set_new (oc->parse_order.merchant,
"address",
@@ -1858,17 +1859,18 @@ parse_order (struct OrderContext *oc)
}
}
{
- json_t *locj;
+ json_t *juri;
/* Handle merchant jurisdiction */
- locj = settings->jurisdiction;
- if (NULL != locj)
+ juri = settings->jurisdiction;
+ if (NULL != juri)
{
- locj = json_deep_copy (locj);
+ juri = json_deep_copy (juri);
+ GNUNET_assert (NULL != juri);
GNUNET_assert (0 ==
json_object_set_new (oc->parse_order.merchant,
"jurisdiction",
- locj));
+ juri));
}
}
}
diff --git a/src/backend/taler-merchant-httpd_private-post-token-families.c b/src/backend/taler-merchant-httpd_private-post-token-families.c
index 6bf048f9..b9be59d8 100644
--- a/src/backend/taler-merchant-httpd_private-post-token-families.c
+++ b/src/backend/taler-merchant-httpd_private-post-token-families.c
@@ -86,7 +86,7 @@ TMH_private_post_token_families (const struct TMH_RequestHandler *rh,
GNUNET_JSON_spec_json ("description_i18n",
&details.description_i18n),
NULL),
- GNUNET_JSON_spec_string("kind", &kind),
+ GNUNET_JSON_spec_string ("kind", &kind),
GNUNET_JSON_spec_timestamp ("valid_after",
&details.valid_after),
GNUNET_JSON_spec_timestamp ("valid_before",
@@ -113,13 +113,14 @@ TMH_private_post_token_families (const struct TMH_RequestHandler *rh,
}
- if (strcmp(kind, "discount") == 0)
+ if (strcmp (kind, "discount") == 0)
details.kind = TALER_MERCHANTDB_TFK_Discount;
- else if (strcmp(kind, "subscription") == 0)
+ else if (strcmp (kind, "subscription") == 0)
details.kind = TALER_MERCHANTDB_TFK_Subscription;
else
{
GNUNET_break (0);
+ GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED,
@@ -194,7 +195,7 @@ TMH_private_post_token_families (const struct TMH_RequestHandler *rh,
NULL,
NULL,
0)
- // TODO: Use proper error code
+ // TODO: Use proper error code
: TALER_MHD_reply_with_error (connection,
MHD_HTTP_CONFLICT,
0,