From 5017dacbdaac2d1654b01329f97b8b5b7dc34ba9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 27 Aug 2021 14:35:59 +0200 Subject: -fix memory leak --- src/include/taler_mhd_lib.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/include/taler_mhd_lib.h') diff --git a/src/include/taler_mhd_lib.h b/src/include/taler_mhd_lib.h index 3af413fa8..aba7cd8e2 100644 --- a/src/include/taler_mhd_lib.h +++ b/src/include/taler_mhd_lib.h @@ -124,6 +124,21 @@ TALER_MHD_reply_json (struct MHD_Connection *connection, unsigned int response_code); +/** + * Send JSON object as response, and free the @a json + * object. + * + * @param connection the MHD connection + * @param json the json object (freed!) + * @param response_code the http response code + * @return MHD result code + */ +MHD_RESULT +TALER_MHD_reply_json_steal (struct MHD_Connection *connection, + json_t *json, + unsigned int response_code); + + /** * Function to call to handle the request by building a JSON * reply from a format string and varargs. @@ -151,8 +166,8 @@ TALER_MHD_reply_json_pack (struct MHD_Connection *connection, * @return MHD result code */ #define TALER_MHD_REPLY_JSON_PACK(connection,response_code,...) \ - TALER_MHD_reply_json (connection, GNUNET_JSON_PACK (__VA_ARGS__), \ - response_code) + TALER_MHD_reply_json_steal (connection, GNUNET_JSON_PACK (__VA_ARGS__), \ + response_code) /** -- cgit v1.2.3