aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-27 16:17:45 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-27 16:17:45 +0200
commit5026518bb5a6c47b9278eede81989ca0fba7094a (patch)
tree2fab84462e22f05ce0dec738aec28391268e0ea8
parent5017dacbdaac2d1654b01329f97b8b5b7dc34ba9 (diff)
downloadexchange-5026518bb5a6c47b9278eede81989ca0fba7094a.tar.gz
exchange-5026518bb5a6c47b9278eede81989ca0fba7094a.zip
-fix another leak
-rw-r--r--src/include/taler_mhd_lib.h12
-rw-r--r--src/mhd/mhd_responses.c11
2 files changed, 22 insertions, 1 deletions
diff --git a/src/include/taler_mhd_lib.h b/src/include/taler_mhd_lib.h
index aba7cd8e2..ba5a072c4 100644
--- a/src/include/taler_mhd_lib.h
+++ b/src/include/taler_mhd_lib.h
@@ -212,6 +212,16 @@ TALER_MHD_make_json (const json_t *json);
212 212
213 213
214/** 214/**
215 * Make JSON response object and free @a json.
216 *
217 * @param json the json object, freed.
218 * @return MHD response object
219 */
220struct MHD_Response *
221TALER_MHD_make_json_steal (json_t *json);
222
223
224/**
215 * Make JSON response object. 225 * Make JSON response object.
216 * 226 *
217 * @param fmt format string for pack 227 * @param fmt format string for pack
@@ -230,7 +240,7 @@ TALER_MHD_make_json_pack (const char *fmt,
230 * @return MHD response object 240 * @return MHD response object
231 */ 241 */
232#define TALER_MHD_MAKE_JSON_PACK(...) \ 242#define TALER_MHD_MAKE_JSON_PACK(...) \
233 TALER_MHD_make_json (GNUNET_JSON_PACK (__VA_ARGS__)) 243 TALER_MHD_make_json_steal (GNUNET_JSON_PACK (__VA_ARGS__))
234 244
235 245
236/** 246/**
diff --git a/src/mhd/mhd_responses.c b/src/mhd/mhd_responses.c
index b7ff52e66..c993436cd 100644
--- a/src/mhd/mhd_responses.c
+++ b/src/mhd/mhd_responses.c
@@ -148,6 +148,17 @@ TALER_MHD_make_json (const json_t *json)
148} 148}
149 149
150 150
151struct MHD_Response *
152TALER_MHD_make_json_steal (json_t *json)
153{
154 struct MHD_Response *res;
155
156 res = TALER_MHD_make_json (json);
157 json_decref (json);
158 return res;
159}
160
161
151MHD_RESULT 162MHD_RESULT
152TALER_MHD_reply_json (struct MHD_Connection *connection, 163TALER_MHD_reply_json (struct MHD_Connection *connection,
153 const json_t *json, 164 const json_t *json,