commit 3b472ed491ac8ce5c58a55f1ca40d31d1a093413
parent 279866ee19cc8af9e09efe0d24cd6040291dbd2c
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 30 Aug 2025 23:56:56 +0200
-fix memory leak
Diffstat:
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-get-products-ID.c b/src/backend/taler-merchant-httpd_private-get-products-ID.c
@@ -86,8 +86,8 @@ TMH_private_get_products_ID (
pd.product_name),
GNUNET_JSON_pack_string ("description",
pd.description),
- GNUNET_JSON_pack_object_steal ("description_i18n",
- pd.description_i18n),
+ GNUNET_JSON_pack_object_incref ("description_i18n",
+ pd.description_i18n),
GNUNET_JSON_pack_string ("unit",
pd.unit),
GNUNET_JSON_pack_array_steal ("categories",
@@ -98,8 +98,8 @@ TMH_private_get_products_ID (
GNUNET_JSON_pack_string ("image",
pd.image)),
GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_array_steal ("taxes",
- pd.taxes)),
+ GNUNET_JSON_pack_array_incref ("taxes",
+ pd.taxes)),
GNUNET_JSON_pack_int64 ("total_stock",
(INT64_MAX == pd.total_stock)
? -1LL
@@ -109,16 +109,14 @@ TMH_private_get_products_ID (
GNUNET_JSON_pack_uint64 ("total_lost",
pd.total_lost),
GNUNET_JSON_pack_allow_null (
- GNUNET_JSON_pack_object_steal ("address",
- pd.address)),
+ GNUNET_JSON_pack_object_incref ("address",
+ pd.address)),
GNUNET_JSON_pack_allow_null (
GNUNET_JSON_pack_timestamp ("next_restock",
(pd.next_restock))),
GNUNET_JSON_pack_uint64 ("minimum_age",
pd.minimum_age));
- GNUNET_free (pd.description);
- GNUNET_free (pd.image);
- GNUNET_free (pd.unit);
+ TALER_MERCHANTDB_product_details_free (&pd);
return ret;
}
}