Fix coverity check issues

Shi, Burvin burvin at amazon.com
Thu Nov 20 23:43:42 PST 2025


>From d65ef00502abc15efde3bcb0fc2e2d8ab82f59bf 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/common/dpp_crypto.c | 1 +
 src/wps/http_server.c   | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/common/dpp_crypto.c b/src/common/dpp_crypto.c
index f17f95a2c..4b5f24378 100644
--- a/src/common/dpp_crypto.c
+++ b/src/common/dpp_crypto.c
@@ -2371,6 +2371,7 @@ struct crypto_ec_point * dpp_decrypt_e_id(struct crypto_ec_key *ppkey,
 	    crypto_ec_point_invert(ec, e_id) ||
 	    crypto_ec_point_add(ec, e_id, e_prime_id_point, e_id)) {
 		crypto_ec_point_deinit(e_id, 1);
+		e_id = NULL;
 		goto fail;
 	}
 
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