commit 30c85e657b552c3287d80c38cda3f6ec98fa48a3
parent 476b220f6df713ecc809cb80aec88bd5f9121ac6
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 25 May 2026 23:57:45 +0200
more minor fixes
Diffstat:
6 files changed, 20 insertions(+), 41 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_get-orders-ORDER_ID.c b/src/backend/taler-merchant-httpd_get-orders-ORDER_ID.c
@@ -384,11 +384,6 @@ god_cleanup (void *cls)
json_decref (god->contract_terms_json);
god->contract_terms_json = NULL;
}
- if (NULL != god->contract_terms)
- {
- TALER_MERCHANT_contract_free (god->contract_terms);
- god->contract_terms = NULL;
- }
if (NULL != god->order_json)
{
json_decref (god->order_json);
diff --git a/src/backend/taler-merchant-httpd_post-private-orders.c b/src/backend/taler-merchant-httpd_post-private-orders.c
@@ -836,36 +836,8 @@ clean_order (void *cls)
0);
for (unsigned int i = 0; i<oc->parse_choices.token_families_len; i++)
{
- struct TALER_MERCHANT_ContractTokenFamily *mctf
- = &oc->parse_choices.token_families[i];
-
- GNUNET_free (mctf->slug);
- GNUNET_free (mctf->name);
- GNUNET_free (mctf->description);
- json_decref (mctf->description_i18n);
- switch (mctf->kind)
- {
- case TALER_MERCHANT_CONTRACT_TOKEN_KIND_INVALID:
- GNUNET_break (0);
- break;
- case TALER_MERCHANT_CONTRACT_TOKEN_KIND_SUBSCRIPTION:
- for (size_t j = 0; j<mctf->details.subscription.trusted_domains_len; j++)
- GNUNET_free (mctf->details.subscription.trusted_domains[j]);
- GNUNET_free (mctf->details.subscription.trusted_domains);
- break;
- case TALER_MERCHANT_CONTRACT_TOKEN_KIND_DISCOUNT:
- for (size_t j = 0; j<mctf->details.discount.expected_domains_len; j++)
- GNUNET_free (mctf->details.discount.expected_domains[j]);
- GNUNET_free (mctf->details.discount.expected_domains);
- break;
- }
- for (unsigned int j = 0; j<mctf->keys_len; j++)
- {
- GNUNET_CRYPTO_blind_sign_pub_decref (mctf->keys[j].pub.public_key);
- }
- GNUNET_array_grow (mctf->keys,
- mctf->keys_len,
- 0);
+ TALER_MERCHANT_contract_token_family_free (
+ &oc->parse_choices.token_families[i]);
}
GNUNET_array_grow (oc->parse_choices.token_families,
oc->parse_choices.token_families_len,
diff --git a/src/util/contract_choice_serialize.c b/src/util/contract_choice_serialize.c
@@ -87,6 +87,12 @@ json_from_contract_output (
output->details.token.token_family_slug),
GNUNET_JSON_pack_uint64 ("count",
output->details.token.count),
+ GNUNET_TIME_absolute_is_zero (output->details.token.valid_at.abs_time)
+ ? GNUNET_JSON_pack_allow_null (
+ GNUNET_JSON_pack_string ("dummy",
+ NULL))
+ : GNUNET_JSON_pack_timestamp ("valid_at",
+ output->details.token.valid_at),
GNUNET_JSON_pack_uint64 ("key_index",
output->details.token.key_index));
case TALER_MERCHANT_CONTRACT_OUTPUT_TYPE_DONATION_RECEIPT:
diff --git a/src/util/merchant_parse.c b/src/util/merchant_parse.c
@@ -108,11 +108,11 @@ TALER_MERCHANT_metadata_to_json (
GNUNET_JSON_pack_string ("logo",
merchant->logo)),
GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_object_steal ("address",
- merchant->address)),
+ GNUNET_JSON_pack_object_incref ("address",
+ merchant->address)),
GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_object_steal ("jurisdiction",
- merchant->jurisdiction)));
+ GNUNET_JSON_pack_object_incref ("jurisdiction",
+ merchant->jurisdiction)));
}
diff --git a/src/util/product_parse.c b/src/util/product_parse.c
@@ -268,6 +268,7 @@ TALER_MERCHANT_parse_product_sold (const json_t *pj,
}
else if (! no_price)
{
+ r->prices_length = 1;
r->prices = GNUNET_new_array (1,
struct TALER_Amount);
r->prices[0] = price;
diff --git a/src/util/token_family_parse.c b/src/util/token_family_parse.c
@@ -39,16 +39,21 @@ TALER_MERCHANT_contract_token_family_free (
}
for (unsigned int i = 0; i < family->keys_len; i++)
TALER_token_issue_pub_free (&family->keys[i].pub);
- GNUNET_free (family->keys);
-
+ GNUNET_array_grow (family->keys,
+ family->keys_len,
+ 0);
switch (family->kind)
{
case TALER_MERCHANT_CONTRACT_TOKEN_KIND_INVALID:
+ GNUNET_break (0);
break;
case TALER_MERCHANT_CONTRACT_TOKEN_KIND_DISCOUNT:
for (unsigned int i = 0; i < family->details.discount.expected_domains_len;
i++)
GNUNET_free (family->details.discount.expected_domains[i]);
+ GNUNET_array_grow (family->details.discount.expected_domains,
+ family->details.discount.expected_domains_len,
+ 0);
break;
case TALER_MERCHANT_CONTRACT_TOKEN_KIND_SUBSCRIPTION:
for (unsigned int i = 0; i < family->details.subscription.