summaryrefslogtreecommitdiff
path: root/src/journal-remote/microhttpd-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-12-07 12:13:10 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-01-09 23:44:17 +0100
commitd101fb24eb1c58c97f2adce1f69f4b61a788933a (patch)
treee88ca52758e0860935dddc1d3bdee1ce341c1b77 /src/journal-remote/microhttpd-util.c
parent6670c9de196c8e2d5e84a8890cbb68f70c4db6e3 (diff)
downloadsystemd-d101fb24eb1c58c97f2adce1f69f4b61a788933a.tar.gz
µhttpd: use a cleanup function to call MHD_destroy_response
Diffstat (limited to 'src/journal-remote/microhttpd-util.c')
-rw-r--r--src/journal-remote/microhttpd-util.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/journal-remote/microhttpd-util.c b/src/journal-remote/microhttpd-util.c
index adf40b5abd..6d049d11f7 100644
--- a/src/journal-remote/microhttpd-util.c
+++ b/src/journal-remote/microhttpd-util.c
@@ -32,21 +32,16 @@ static int mhd_respond_internal(struct MHD_Connection *connection,
const char *buffer,
size_t size,
enum MHD_ResponseMemoryMode mode) {
- struct MHD_Response *response;
- int r;
-
assert(connection);
- response = MHD_create_response_from_buffer(size, (char*) buffer, mode);
+ _cleanup_(MHD_destroy_responsep) struct MHD_Response *response
+ = MHD_create_response_from_buffer(size, (char*) buffer, mode);
if (!response)
return MHD_NO;
log_debug("Queueing response %u: %s", code, buffer);
MHD_add_response_header(response, "Content-Type", "text/plain");
- r = MHD_queue_response(connection, code, response);
- MHD_destroy_response(response);
-
- return r;
+ return MHD_queue_response(connection, code, response);
}
int mhd_respond(struct MHD_Connection *connection,