You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ja...@apache.org on 2026/10/19 13:18:29 UTC

(mynewt-nimble) 01/02: nimble/mesh: Ignore disconnects without a proxy client

This is an automated email from the ASF dual-hosted git repository.

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit ee48d1104a778eb9b6f51e50a301d1f6af4e3017
Author: raiden00pl <ra...@railab.me>
AuthorDate: Sat Oct 3 09:30:27 2026 +0200

    nimble/mesh: Ignore disconnects without a proxy client
    
    A PB-GATT provisioning connection has no proxy client. Check the lookup
    before dereferencing it or decrementing the proxy connection count.
    
    Assisted-by: Codex:GPT-6
    Signed-off-by: raiden00pl <ra...@railab.me>
---
 nimble/host/mesh/src/proxy_srv.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/nimble/host/mesh/src/proxy_srv.c b/nimble/host/mesh/src/proxy_srv.c
index 22d9082cd..8611093b1 100644
--- a/nimble/host/mesh/src/proxy_srv.c
+++ b/nimble/host/mesh/src/proxy_srv.c
@@ -863,8 +863,12 @@ static void gatt_disconnected(struct ble_gap_conn_desc conn, uint8_t reason)
 		return;
 	}
 
-	conn_count--;
 	client = find_client(conn.conn_handle);
+	if (!client) {
+		return;
+	}
+
+	conn_count--;
 	if (client->cli) {
 		bt_mesh_proxy_role_cleanup(client->cli);
 		client->cli = NULL;