From d49a0536ad3f456d31b38d9ac74e71a4387c6c91 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 19 Feb 2023 13:14:16 +0100 Subject: [PATCH] -fix more memory leaks --- src/exchange/taler-exchange-httpd_keys.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c index 69456cb37..8b72d7803 100644 --- a/src/exchange/taler-exchange-httpd_keys.c +++ b/src/exchange/taler-exchange-httpd_keys.c @@ -1905,6 +1905,7 @@ create_krd (struct TEH_KeyStateHandle *ksh, json_t *extensions = json_object (); bool has_extensions = false; + GNUNET_assert (NULL != extensions); /* Fill in the configurations of the enabled extensions */ for (const struct TALER_Extensions *iter = TALER_extensions_get_head (); NULL != iter && NULL != iter->extension; @@ -1938,7 +1939,7 @@ create_krd (struct TEH_KeyStateHandle *ksh, json_t *sig; int r; - r = json_object_set ( + r = json_object_set_new ( keys, "extensions", extensions); @@ -2258,9 +2259,9 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh) if (age_restricted) { - int r = json_object_set (group->json, - "age_mask", - json_integer (meta.age_mask.bits)); + int r = json_object_set_new (group->json, + "age_mask", + json_integer (meta.age_mask.bits)); GNUNET_assert (0 == r); } @@ -2268,8 +2269,9 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh) list = json_array (); GNUNET_assert (NULL != list); GNUNET_assert (0 == - json_object_set (group->json, denoms_key, list)); - + json_object_set_new (group->json, + denoms_key, + list)); GNUNET_assert ( GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (denominations_by_group, @@ -2353,7 +2355,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh) { /* Add the XOR over all hashes of denominations in this group to the group */ GNUNET_assert (0 == - json_object_set ( + json_object_set_new ( group->json, "hash", GNUNET_JSON_PACK (