diff mbox series

[BlueZ,v2,resend,6/6] shared/gatt-client: add NULL check to discover_secondary_cb()

Message ID 20240710113151.49296-7-r.smirnov@omp.ru (mailing list archive)
State Superseded
Commit 7a45038dc1e505afbaa49f8dd64fd41dab627f23
Headers show
Series fix errors found by SVACE static analyzer #1 | expand

Checks

Context Check Description
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint fail WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search 1: T1 Title exceeds max length (83>80): "[BlueZ,v2,resend,6/6] shared/gatt-client: add NULL check to discover_secondary_cb()"
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Roman Smirnov July 10, 2024, 11:31 a.m. UTC
It is necessary to prevent dereferencing of a NULL pointer.

Found with the SVACE static analysis tool.
---
 src/shared/gatt-client.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index b48d739fc..9db3f5211 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -1276,7 +1276,9 @@  next:
 
 	range = queue_peek_head(op->discov_ranges);
 
-	client->discovery_req = bt_gatt_discover_included_services(client->att,
+	if (range)
+		client->discovery_req = bt_gatt_discover_included_services(
+							client->att,
 							range->start,
 							range->end,
 							discover_incl_cb,