diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-12-07 12:13:10 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-01-09 23:44:17 +0100 |
commit | d101fb24eb1c58c97f2adce1f69f4b61a788933a (patch) | |
tree | e88ca52758e0860935dddc1d3bdee1ce341c1b77 /src/journal-remote/microhttpd-util.c | |
parent | journald: lower the maximum entry size limit to ½ for non-sealed fds (diff) | |
download | systemd-d101fb24eb1c58c97f2adce1f69f4b61a788933a.tar.xz systemd-d101fb24eb1c58c97f2adce1f69f4b61a788933a.zip |
µ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.c | 11 |
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, |