gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: -fix memory leak


From: gnunet
Subject: [taler-exchange] branch master updated: -fix memory leak
Date: Fri, 27 Aug 2021 14:36:06 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 5017dacb -fix memory leak
5017dacb is described below

commit 5017dacbdaac2d1654b01329f97b8b5b7dc34ba9
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Aug 27 14:35:59 2021 +0200

    -fix memory leak
---
 src/include/taler_mhd_lib.h | 19 +++++++++++++++++--
 src/mhd/mhd_responses.c     | 15 +++++++++++++++
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/src/include/taler_mhd_lib.h b/src/include/taler_mhd_lib.h
index 3af413fa..aba7cd8e 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)
 
 
 /**
diff --git a/src/mhd/mhd_responses.c b/src/mhd/mhd_responses.c
index 6b96de55..b7ff52e6 100644
--- a/src/mhd/mhd_responses.c
+++ b/src/mhd/mhd_responses.c
@@ -219,6 +219,21 @@ TALER_MHD_reply_json (struct MHD_Connection *connection,
 }
 
 
+MHD_RESULT
+TALER_MHD_reply_json_steal (struct MHD_Connection *connection,
+                            json_t *json,
+                            unsigned int response_code)
+{
+  MHD_RESULT ret;
+
+  ret = TALER_MHD_reply_json (connection,
+                              json,
+                              response_code);
+  json_decref (json);
+  return ret;
+}
+
+
 MHD_RESULT
 TALER_MHD_reply_cors_preflight (struct MHD_Connection *connection)
 {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]