commit 11a59c157d57ba729b94cf423e99a84f5f5762d5
parent a6b7dca41a518ba2283b77e5520fda224a5d34f6
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 9 May 2025 22:14:43 +0200
yet another leak
Diffstat:
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
@@ -1905,12 +1905,16 @@ TALER_JSON_spec_array_fixed (
*/
struct closure_array_of_data
{
- /* Fixed (known) size per entry */
+ /**
+ * Fixed (known) size per entry
+ */
size_t entry_size;
- /* Pointer where to put the number of elements
+ /**
+ * Pointer where to put the number of elements
* allocated, i.e. the number of elements in the
- * json array. */
+ * json array.
+ */
size_t *num_entries;
};
@@ -1942,7 +1946,7 @@ parse_array_of_data (void *cls,
spec->ptr_size = num_entries * info->entry_size;
GNUNET_assert (spec->ptr_size > num_entries);
- *(char **) spec->ptr = GNUNET_malloc (spec->ptr_size);
+ *((char **) spec->ptr) = GNUNET_malloc (spec->ptr_size);
{
json_t *j_entry;
@@ -1986,6 +1990,7 @@ cleaner_array_of_data (void *cls,
{
struct closure_array_of_data *info = cls;
+ GNUNET_free (*(void **) spec->ptr);
GNUNET_free (info);
}
@@ -2026,7 +2031,7 @@ TALER_JSON_spec_array_of_denom_pub_h (
{
return TALER_JSON_spec_array_of_data (
field,
- sizeof(struct TALER_DenominationHashP),
+ sizeof (struct TALER_DenominationHashP),
num_entries,
(void **) entries);
}