Fix coverity check issues

Shi, Burvin burvin at amazon.com
Thu Nov 20 23:27:34 PST 2025


>From 05ace7cefb361ba05d2a684d20d7bdd45829dc3c Mon Sep 17 00:00:00 2001
From: Burvin Shi <burvin at amazon.com>
Date: Fri, 21 Nov 2025 07:07:04 +0000
Subject: [PATCH] Fix coverity check issues

Fix two issues detected by coverity check tool

Signed-off-by: Burvin Shi <burvin at amazon.com>
---
 src/wps/http_server.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/wps/http_server.c b/src/wps/http_server.c
index 507abe870..c44cdff1e 100644
--- a/src/wps/http_server.c
+++ b/src/wps/http_server.c
@@ -65,12 +65,15 @@ static struct http_request * http_request_init(struct http_server *srv, int fd,
 
 	if (srv->request_count >= HTTP_SERVER_MAX_CONNECTIONS) {
 		wpa_printf(MSG_DEBUG, "HTTP: Too many concurrent requests");
+		close(fd);
 		return NULL;
 	}
 
 	req = os_zalloc(sizeof(*req));
-	if (req == NULL)
+	if (req == NULL) {
+		close(fd);
 		return NULL;
+	}
 
 	req->srv = srv;
 	req->fd = fd;
@@ -215,7 +218,6 @@ static void http_server_cb(int sd, void *eloop_ctx, void *sock_ctx)
 
 	req = http_request_init(srv, conn, &addr);
 	if (req == NULL) {
-		close(conn);
 		return;
 	}
 
-- 
2.47.3




More information about the Hostap mailing list