From a95379df0fd685123f035fe2dd68eab24fdab52f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 8 Jul 2022 14:29:53 +0200 Subject: -fix leaks --- .../taler-merchant-httpd_private-post-orders.c | 35 +++++++++++++++------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'src/backend') diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c index efaaf5a7..22dded0b 100644 --- a/src/backend/taler-merchant-httpd_private-post-orders.c +++ b/src/backend/taler-merchant-httpd_private-post-orders.c @@ -766,6 +766,7 @@ patch_order (struct MHD_Connection *connection, tm_info = localtime (&timer); if (NULL == tm_info) { + GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error ( connection, MHD_HTTP_INTERNAL_SERVER_ERROR, @@ -816,8 +817,8 @@ patch_order (struct MHD_Connection *connection, if (strstr (pos + strlen ("${ORDER_ID}"), "${ORDER_ID}")) { - /* FIXME: free anything? */ 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, @@ -882,6 +883,7 @@ patch_order (struct MHD_Connection *connection, now)) ) { GNUNET_break_op (0); + GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error ( connection, MHD_HTTP_BAD_REQUEST, @@ -913,6 +915,7 @@ patch_order (struct MHD_Connection *connection, if (GNUNET_TIME_absolute_is_never (wire_deadline.abs_time)) { GNUNET_break_op (0); + GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error ( connection, MHD_HTTP_BAD_REQUEST, @@ -931,6 +934,7 @@ patch_order (struct MHD_Connection *connection, refund_deadline)) { GNUNET_break_op (0); + GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error ( connection, MHD_HTTP_BAD_REQUEST, @@ -985,6 +989,7 @@ patch_order (struct MHD_Connection *connection, ('/' != merchant_base_url[strlen (merchant_base_url) - 1])) { GNUNET_break_op (0); + GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error ( connection, MHD_HTTP_BAD_REQUEST, @@ -996,6 +1001,7 @@ patch_order (struct MHD_Connection *connection, if (NULL != jmerchant) { GNUNET_break_op (0); + GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error ( connection, MHD_HTTP_BAD_REQUEST, @@ -1065,6 +1071,7 @@ patch_order (struct MHD_Connection *connection, if (GNUNET_OK != TALER_JSON_contract_seed_forgettable (order)) { + GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error ( connection, MHD_HTTP_BAD_REQUEST, @@ -1092,12 +1099,14 @@ patch_order (struct MHD_Connection *connection, { case GNUNET_SYSERR: GNUNET_break (0); + GNUNET_JSON_parse_free (spec); return TALER_MHD_reply_with_error ( connection, MHD_HTTP_INTERNAL_SERVER_ERROR, TALER_EC_GENERIC_FAILED_COMPUTE_JSON_HASH, "could not compute hash of patched order"); case GNUNET_NO: + GNUNET_JSON_parse_free (spec); GNUNET_break_op (0); return TALER_MHD_reply_with_error ( connection, @@ -1108,15 +1117,21 @@ patch_order (struct MHD_Connection *connection, break; } } - return execute_order (connection, - hc, - h_post_data, - order, - claim_token, - inventory_products_length, - inventory_products, - uuids_length, - uuids); + { + MHD_RESULT mres; + + mres = execute_order (connection, + hc, + h_post_data, + order, + claim_token, + inventory_products_length, + inventory_products, + uuids_length, + uuids); + GNUNET_JSON_parse_free (spec); + return mres; + } } -- cgit v1.2.3