X Tutup
Skip to content

Commit c60d95c

Browse files
committed
journal-gatewayd: use automatic cleanup
1 parent fa92d38 commit c60d95c

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/journal-remote/journal-gatewayd.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ static int request_handler_redirect(
641641
struct MHD_Connection *connection,
642642
const char *target) {
643643

644-
char *page;
644+
_cleanup_free_ char *page = NULL;
645645
_cleanup_(MHD_destroy_responsep) struct MHD_Response *response = NULL;
646646

647647
assert(connection);
@@ -651,10 +651,9 @@ static int request_handler_redirect(
651651
return respond_oom(connection);
652652

653653
response = MHD_create_response_from_buffer(strlen(page), page, MHD_RESPMEM_MUST_FREE);
654-
if (!response) {
655-
free(page);
654+
if (!response)
656655
return respond_oom(connection);
657-
}
656+
TAKE_PTR(page);
658657

659658
if (MHD_add_response_header(response, "Content-Type", "text/html") == MHD_NO ||
660659
MHD_add_response_header(response, "Location", target) == MHD_NO)

0 commit comments

Comments
 (0)
X Tutup