commit 9f2bca9fe7cd211063f03948f3efb523edc96076
parent 419fa673740b9df06a2a042ef0bb8cbed3b883f3
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 29 Jul 2026 16:49:37 +0200
free the parsed request body on early returns in truth upload
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/backend/anastasis-httpd_truth-upload.c b/src/backend/anastasis-httpd_truth-upload.c
@@ -634,6 +634,7 @@ AH_handler_truth_post (
if (storage_years > ANASTASIS_MAX_YEARS_STORAGE)
{
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,
@@ -655,10 +656,13 @@ AH_handler_truth_post (
truth_uuid,
&paid_until);
if (qs < 0)
+ {
+ GNUNET_JSON_parse_free (spec);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_GENERIC_DB_FETCH_FAILED,
NULL);
+ }
if ( (0 == qs) ||
(GNUNET_TIME_timestamp_cmp (paid_until,
<,
@@ -680,6 +684,7 @@ AH_handler_truth_post (
tuc->years_to_pay))
{
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,
@@ -690,6 +695,9 @@ AH_handler_truth_post (
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Truth upload payment required (%d)!\n",
qs);
+ /* `spec' is re-parsed from tuc->json when MHD resumes us, and
+ begin_payment() only touches `tuc', so release it now. */
+ GNUNET_JSON_parse_free (spec);
return begin_payment (tuc);
}
}