Skip to content

Commit c12eeaf

Browse files
committed
http-api: Fix leak on error
1 parent bb6e86f commit c12eeaf

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/http_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static int check_access(struct mosquitto__listener *listener, struct MHD_Connect
348348
context.listener = listener;
349349

350350
context.id = (char *)"http-api";
351-
context.username = MHD_basic_auth_get_username_password (connection, &context.password);
351+
context.username = MHD_basic_auth_get_username_password(connection, &context.password);
352352

353353
/* Authentication */
354354
auth_rc = mosquitto_basic_auth(&context);
@@ -362,6 +362,7 @@ static int check_access(struct mosquitto__listener *listener, struct MHD_Connect
362362
char *buf = "Not authorised\n";
363363
struct MHD_Response *response = MHD_create_response_from_buffer(strlen(buf), (void *)buf, MHD_RESPMEM_MUST_COPY);
364364
MHD_queue_basic_auth_fail_response(connection, "Mosquitto API", response);
365+
MHD_destroy_response(response);
365366

366367
return MOSQ_ERR_AUTH;
367368
}

0 commit comments

Comments
 (0)