commit d2a1c511389e3f64d963d8a0c58f1690c8d0c378 parent 1941102d3e43d17cce387273ed09ea24c3c85521 Author: Christian Grothoff <grothoff@gnunet.org> Date: Fri, 10 Jul 2026 23:12:22 +0200 fix misc. minor leaks Diffstat:
13 files changed, 46 insertions(+), 21 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd_post-melt.c b/src/exchange/taler-exchange-httpd_post-melt.c @@ -954,11 +954,11 @@ phase_check_coin_signature ( &mc->request.refresh.rc, &mc->request.refresh.refresh_seed, mc->request.no_blinding_seed - ? NULL - : &mc->request.refresh.blinding_seed, + ? NULL + : &mc->request.refresh.blinding_seed, mc->request.refresh.is_v27_refresh - ? NULL - : &k_transfer_pubs, + ? NULL + : &k_transfer_pubs, &k_bps_h, &mc->request.refresh.coin.coin_pub, &mc->request.refresh.amount_with_fee); diff --git a/src/exchange/taler-exchange-httpd_post-reveal-melt.c b/src/exchange/taler-exchange-httpd_post-reveal-melt.c @@ -627,7 +627,11 @@ verify_commitment ( &details[coin_idx], result); if (GNUNET_OK != ret) + { + for (size_t i = 0; i < rf->num_coins; i++) + TALER_planchet_detail_free (&details[i]); return GNUNET_SYSERR; + } } /** * Now we can generate the hashes for the kappa-th batch of coins @@ -637,7 +641,7 @@ verify_commitment ( details, &kappa_planchets_h.tuple[k]); - for (size_t i =0; i<rf->num_coins; i++) + for (size_t i = 0; i<rf->num_coins; i++) TALER_planchet_detail_free (&details[i]); } } diff --git a/src/exchange/taler-exchange-httpd_post-reveal-withdraw.c b/src/exchange/taler-exchange-httpd_post-reveal-withdraw.c @@ -483,6 +483,7 @@ verify_commitment_and_max_age ( result); if (GNUNET_OK != ret) { + GNUNET_CRYPTO_hash_context_abort (batch_ctx); GNUNET_CRYPTO_hash_context_abort (hash_context); return GNUNET_SYSERR; } diff --git a/src/include/taler/taler_templating_lib.h b/src/include/taler/taler_templating_lib.h @@ -74,8 +74,8 @@ TALER_TEMPLATING_fill2 (const void *tmpl, * @param taler_uri value for "Taler:" header to set, or NULL * @param root JSON object to pass as the root context * @param[out] reply where to write the response object - * @return #GNUNET_OK on success (reply queued), #GNUNET_NO if an error was queued, - * #GNUNET_SYSERR on failure (to queue an error) + * @return #GNUNET_OK on success (@a reply built), #GNUNET_NO if an error + * reply was built, #GNUNET_SYSERR on failure (no reply built) */ enum GNUNET_GenericReturnValue TALER_TEMPLATING_build (struct MHD_Connection *connection, diff --git a/src/kyclogic/plugin_kyclogic_kycaid.c b/src/kyclogic/plugin_kyclogic_kycaid.c @@ -1353,10 +1353,6 @@ kycaid_webhook (void *cls, wh->ps = ps; wh->pd = pd; wh->connection = connection; - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "KYCAID webhook of `%s' triggered with %s\n", - pd->section, - http_method); #if DEBUG if (NULL != body) json_dumpf (body, @@ -1379,7 +1375,10 @@ kycaid_webhook (void *cls, wh); return wh; } - + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "KYCAID webhook of `%s' triggered with %s\n", + pd->section, + http_method); if (GNUNET_OK != GNUNET_JSON_parse (body, spec, diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c @@ -431,7 +431,7 @@ parse_restrictions (const json_t *jresta, GNUNET_assert (alen == *resta_len); *resta = GNUNET_new_array (*resta_len, struct TALER_EXCHANGE_AccountRestriction); - for (unsigned int i = 0; i<*resta_len; i++) + for (unsigned int i = 0; i< *resta_len; i++) { const json_t *jr = json_array_get (jresta, i); @@ -486,7 +486,7 @@ parse_restrictions (const json_t *jresta, } /* unsupported type */ GNUNET_break (0); - return GNUNET_SYSERR; + goto fail; } return GNUNET_OK; fail: diff --git a/src/lib/exchange_api_get-aml-OFFICER_PUB-attributes-H_NORMALIZED_PAYTO.c b/src/lib/exchange_api_get-aml-OFFICER_PUB-attributes-H_NORMALIZED_PAYTO.c @@ -93,7 +93,7 @@ struct TALER_EXCHANGE_GetAmlAttributesHandle int64_t limit; /** - * Row offset threshold. Default: UINT64_MAX. + * Row offset threshold. Default: INT64_MAX. */ uint64_t offset; } options; diff --git a/src/lib/exchange_api_get-aml-OFFICER_PUB-decisions.c b/src/lib/exchange_api_get-aml-OFFICER_PUB-decisions.c @@ -28,6 +28,7 @@ #include "taler/taler_signatures.h" #include "exchange_api_curl_defaults.h" +#define DEBUG 0 /** * @brief A GET /aml/$OFFICER_PUB/decisions Handle @@ -486,9 +487,11 @@ handle_get_aml_decisions_finished (void *cls, case MHD_HTTP_NO_CONTENT: break; case MHD_HTTP_BAD_REQUEST: +#if DEBUG json_dumpf (j, stderr, JSON_INDENT (2)); +#endif lr.hr.ec = TALER_JSON_get_error_code (j); lr.hr.hint = TALER_JSON_get_error_hint (j); break; diff --git a/src/lib/exchange_api_get-reserves-RESERVE_PUB-history.c b/src/lib/exchange_api_get-reserves-RESERVE_PUB-history.c @@ -29,6 +29,7 @@ #include "taler/taler_signatures.h" #include "exchange_api_curl_defaults.h" +#define DEBUG 0 /** * @brief A GET /reserves/$RESERVE_PUB/history Handle @@ -893,9 +894,11 @@ parse_reserve_history ( NULL, NULL)) { GNUNET_break_op (0); +#if DEBUG json_dumpf (transaction, stderr, JSON_INDENT (2)); +#endif GNUNET_free (uuid); return GNUNET_SYSERR; } diff --git a/src/lib/exchange_api_post-batch-deposit.c b/src/lib/exchange_api_post-batch-deposit.c @@ -32,6 +32,7 @@ #include "taler/taler_signatures.h" #include "exchange_api_curl_defaults.h" +#define DEBUG 0 /** * 1:#AUDITOR_CHANCE is the probability that we report deposits @@ -834,11 +835,13 @@ TALER_EXCHANGE_post_batch_deposit_start ( curl_easy_cleanup (eh); return TALER_EC_GENERIC_CURL_ALLOCATION_FAILURE; } - /* Help debug #11305 */ + /* FIXME: Help debug #11305 */ +#if DEBUG GNUNET_assert (CURLE_OK == curl_easy_setopt (eh, CURLOPT_VERBOSE, 1)); +#endif GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "URL for batch-deposit: `%s'\n", pbdh->url); diff --git a/src/lib/exchange_api_post-reserves-RESERVE_PUB-purse.c b/src/lib/exchange_api_post-reserves-RESERVE_PUB-purse.c @@ -631,6 +631,7 @@ TALER_EXCHANGE_post_reserves_purse_start ( body)) ) { GNUNET_break (0); + json_decref (body); if (NULL != eh) curl_easy_cleanup (eh); return TALER_EC_GENERIC_CURL_ALLOCATION_FAILURE; diff --git a/src/mhd/mhd_typst.c b/src/mhd/mhd_typst.c @@ -890,6 +890,7 @@ TALER_MHD_typst ( typst_context_fail_async (tc, TALER_EC_EXCHANGE_GENERIC_TYPST_TEMPLATE_FAILURE, err); + GNUNET_free (template_path); return tc; } } @@ -932,6 +933,12 @@ TALER_MHD_response_from_pdf_file (const char *filename) } resp = MHD_create_response_from_fd (s.st_size, fd); + if (NULL == resp) + { + GNUNET_break (0); + GNUNET_assert (0 == close (fd)); + return NULL; + } TALER_MHD_add_global_headers (resp, false); GNUNET_break (MHD_YES == diff --git a/src/templating/templating_api.c b/src/templating/templating_api.c @@ -267,11 +267,14 @@ TALER_TEMPLATING_build (struct MHD_Connection *connection, char *static_url = make_static_url (connection, instance_id); - GNUNET_break (0 == - json_object_set_new ((json_t *) root, - "static_url", - json_string (static_url))); - GNUNET_free (static_url); + if (NULL != static_url) + { + GNUNET_break (0 == + json_object_set_new ((json_t *) root, + "static_url", + json_string (static_url))); + GNUNET_free (static_url); + } } if (0 != (eno = mustach_jansson_mem (tmpl, @@ -308,6 +311,7 @@ TALER_TEMPLATING_build (struct MHD_Connection *connection, MHD_RESPMEM_MUST_FREE); if (NULL == *reply) { + GNUNET_free (body); GNUNET_break (0); return GNUNET_SYSERR; }