commit fd1cac5c4dd4dc121062a214e19bbd9585af943d
parent 9d0e810049affc4077398d42c3c1bb7856a3b5bd
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 2 Apr 2021 14:36:19 +0200
fix more leaks
Diffstat:
7 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c b/src/backend/taler-merchant-httpd_post-tips-ID-pickup.c
@@ -223,6 +223,7 @@ stop_operations (struct PickupContext *pc)
GNUNET_CONTAINER_DLL_remove (pc->po_head,
pc->po_tail,
po);
+ GNUNET_free (po);
}
}
@@ -287,6 +288,7 @@ withdraw_cb (void *cls,
po);
if (NULL == blind_sig)
{
+ GNUNET_free (po);
stop_operations (pc);
pc->http_status = MHD_HTTP_BAD_GATEWAY;
pc->response =
@@ -304,6 +306,7 @@ withdraw_cb (void *cls,
&pc->pickup_id,
po->offset,
blind_sig);
+ GNUNET_free (po);
if (qs < 0)
{
stop_operations (pc);
@@ -354,6 +357,7 @@ do_withdraw (void *cls,
GNUNET_CONTAINER_DLL_remove (pc->po_head,
pc->po_tail,
po);
+ GNUNET_free (po);
pc->http_status = MHD_HTTP_GATEWAY_TIMEOUT;
pc->response = TALER_MHD_make_json_pack (
"{s:s, s:I}",
@@ -372,6 +376,7 @@ do_withdraw (void *cls,
GNUNET_CONTAINER_DLL_remove (pc->po_head,
pc->po_tail,
po);
+ GNUNET_free (po);
pc->http_status = MHD_HTTP_BAD_GATEWAY;
pc->response =
TALER_MHD_make_json_pack (
diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c
@@ -517,9 +517,10 @@ TALER_MERCHANT_order_pay_frontend (
}
if (NULL != session_id)
{
- if (0 != json_object_set (pay_obj,
- "session_id",
- json_string (session_id)))
+ if (0 !=
+ json_object_set_new (pay_obj,
+ "session_id",
+ json_string (session_id)))
{
GNUNET_break (0);
json_decref (pay_obj);
diff --git a/src/lib/merchant_api_tip_pickup.c b/src/lib/merchant_api_tip_pickup.c
@@ -198,6 +198,8 @@ TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context *ctx,
&details[i]))
{
GNUNET_break (0);
+ for (unsigned int j = 0; j<i; j++)
+ GNUNET_free (details[j].coin_ev);
GNUNET_array_grow (tp->planchets,
tp->num_planchets,
0);
@@ -220,6 +222,8 @@ TALER_MERCHANT_tip_pickup (struct GNUNET_CURL_Context *ctx,
details,
&pickup_done_cb,
tp);
+ for (unsigned int j = 0; j<num_planchets; j++)
+ GNUNET_free (details[j].coin_ev);
if (NULL == tp->tpo2)
{
GNUNET_break (0);
diff --git a/src/lib/merchant_api_tip_pickup2.c b/src/lib/merchant_api_tip_pickup2.c
@@ -258,10 +258,12 @@ TALER_MERCHANT_tip_pickup2 (struct GNUNET_CURL_Context *ctx,
" s:o," /* denom_pub_hash */
" s:o," /* coin_ev */
"}",
- "denom_pub_hash", GNUNET_JSON_from_data_auto (
+ "denom_pub_hash",
+ GNUNET_JSON_from_data_auto (
&planchet->denom_pub_hash),
- "coin_ev", GNUNET_JSON_from_data (planchet->coin_ev,
- planchet->coin_ev_size));
+ "coin_ev",
+ GNUNET_JSON_from_data (planchet->coin_ev,
+ planchet->coin_ev_size));
if (NULL == p)
{
GNUNET_break (0);
@@ -278,7 +280,8 @@ TALER_MERCHANT_tip_pickup2 (struct GNUNET_CURL_Context *ctx,
}
}
tp_obj = json_pack ("{s:o}",
- "planchets", pa);
+ "planchets",
+ pa);
if (NULL == tp_obj)
{
GNUNET_break (0);
diff --git a/src/testing/testing_api_cmd_get_reserve.c b/src/testing/testing_api_cmd_get_reserve.c
@@ -258,6 +258,9 @@ get_reserve_cleanup (void *cls,
"GET /private/reserve/$RESERVE_PUB operation did not complete\n");
TALER_MERCHANT_reserve_get_cancel (grs->rgh);
}
+ GNUNET_array_grow (grs->tips,
+ grs->tips_length,
+ 0);
GNUNET_free (grs);
}
diff --git a/src/testing/testing_api_cmd_merchant_get_tip.c b/src/testing/testing_api_cmd_merchant_get_tip.c
@@ -304,6 +304,9 @@ merchant_get_tip_cleanup (void *cls,
TALER_LOG_WARNING ("Get tip operation did not complete\n");
TALER_MERCHANT_merchant_tip_get_cancel (tgs->tgh);
}
+ GNUNET_array_grow (tgs->pickups,
+ tgs->pickups_length,
+ 0);
GNUNET_free (tgs);
}
diff --git a/src/testing/testing_api_cmd_wallet_get_order.c b/src/testing/testing_api_cmd_wallet_get_order.c
@@ -175,13 +175,19 @@ wallet_get_order_cb (
TALER_TESTING_get_trait_order_id (order_cmd,
0,
&order_id))
+ {
+ TALER_MERCHANT_parse_pay_uri_free (&pud);
TALER_TESTING_FAIL (gos->is);
+ }
if (GNUNET_OK !=
TALER_TESTING_get_trait_claim_token (order_cmd,
0,
&claim_token))
+ {
+ TALER_MERCHANT_parse_pay_uri_free (&pud);
TALER_TESTING_FAIL (gos->is);
+ }
{
char *port;
@@ -232,6 +238,7 @@ wallet_get_order_cb (
TALER_MERCHANT_parse_pay_uri_free (&pud);
return;
}
+ TALER_MERCHANT_parse_pay_uri_free (&pud);
}
break;
default: