merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit e09f51b0d4c86537eb74d2c42a4e8617b64fc995
parent 18fcc8b16e8d9117e4b1da70fdccaad6c886f4e2
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sun, 26 Oct 2025 14:07:45 +0100

fix leak (#10505)

Diffstat:
Msrc/backend/taler-merchant-httpd_private-post-orders.c | 25++++++++++---------------
Msrc/include/taler_merchant_util.h | 11+++++++++++
Msrc/util/contract_parse.c | 12+++---------
3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c @@ -959,18 +959,7 @@ clean_order (void *cls) } for (unsigned int i = 0; i<oc->parse_choices.choices_len; i++) { - GNUNET_free (oc->parse_choices.choices[i].description); - if (NULL != oc->parse_choices.choices[i].description_i18n) - { - json_decref (oc->parse_choices.choices[i].description_i18n); - oc->parse_choices.choices[i].description_i18n = NULL; - } - GNUNET_array_grow (oc->parse_choices.choices[i].inputs, - oc->parse_choices.choices[i].inputs_len, - 0); - GNUNET_array_grow (oc->parse_choices.choices[i].outputs, - oc->parse_choices.choices[i].outputs_len, - 0); + TALER_MERCHANT_contract_choice_free (&oc->parse_choices.choices[i]); } GNUNET_array_grow (oc->parse_choices.choices, oc->parse_choices.choices_len, @@ -3423,6 +3412,13 @@ add_donau_output (struct OrderContext *oc, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_GENERIC_DB_FETCH_FAILED, "donau url parsing db call"); + for (unsigned int i = 0; + i < output->details.donation_receipt.donau_urls_len; + i++) + GNUNET_free (output->details.donation_receipt.donau_urls[i]); + GNUNET_array_grow (output->details.donation_receipt.donau_urls, + output->details.donation_receipt.donau_urls_len, + 0); return false; } return true; @@ -3634,19 +3630,18 @@ phase_parse_choices (struct OrderContext *oc) GNUNET_assert (0); break; case TALER_MERCHANT_CONTRACT_OUTPUT_TYPE_DONATION_RECEIPT: - output.details.donation_receipt.amount = choice->amount; #ifdef HAVE_DONAU_DONAU_SERVICE_H + output.details.donation_receipt.amount = choice->amount; if (! add_donau_output (oc, &output)) { GNUNET_break (0); return; } -#endif - GNUNET_array_append (choice->outputs, choice->outputs_len, output); +#endif continue; case TALER_MERCHANT_CONTRACT_OUTPUT_TYPE_TOKEN: /* Ignore inputs tokens with 'count' field set to 0 */ diff --git a/src/include/taler_merchant_util.h b/src/include/taler_merchant_util.h @@ -959,6 +959,17 @@ TALER_MERCHANT_find_token_family_key ( /** + * Free all the fields in the given @a choice, but not @a choice itself, since + * it is normally part of an array. + * + * @param[in] choice contract terms choice to free + */ +void +TALER_MERCHANT_contract_choice_free ( + struct TALER_MERCHANT_ContractChoice *choice); + + +/** * Free the @a contract and all fields in it. * * @param[in] contract contract to free diff --git a/src/util/contract_parse.c b/src/util/contract_parse.c @@ -511,14 +511,8 @@ spec_choices ( } -/** - * Free all the fields in the given @a choice, but not @a choice itself, since - * it is normally part of an array. - * - * @param[in] choice contract terms choice to free - */ -static void -contract_choice_free ( +void +TALER_MERCHANT_contract_choice_free ( struct TALER_MERCHANT_ContractChoice *choice) { for (unsigned int i = 0; i < choice->outputs_len; i++) @@ -1305,7 +1299,7 @@ TALER_MERCHANT_contract_free ( for (unsigned int i = 0; i < contract->details.v1.choices_len; i++) - contract_choice_free (&contract->details.v1.choices[i]); + TALER_MERCHANT_contract_choice_free (&contract->details.v1.choices[i]); GNUNET_free (contract->details.v1.choices); for (unsigned int i = 0; i < contract->details.v1.token_authorities_len;