diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-08-16 15:04:12 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-08-16 15:04:12 -0700 |
commit | 60663d4af3ffb6f82e75a3a4bc73b8b8887a3353 (patch) | |
tree | f37a263d4899b2287aefef4aa39c50d0f825f1e6 /profiles | |
parent | 952c08ff50c5f18b61e99262b93ba679d5f71cc7 (diff) | |
download | bluez-60663d4af3ffb6f82e75a3a4bc73b8b8887a3353.tar.gz |
hog-lib: Fix scan-build error
This fixes the following errors:
profiles/input/hog-lib.c:600:19: warning: Access to field 'handle'
results in a dereference of a null pointer (loaded from variable 'chr')
report->handle = chr->handle;
^~~~~~~~~~~
profiles/input/hog-lib.c:637:11: warning: Access to field 'value_handle'
results in a dereference of a null pointer (loaded from variable 'chr')
start = chr->value_handle + 1;
^~~~~~~~~~~~~~~~~
profiles/input/hog-lib.c:1240:11: warning: Access to field 'value_handle'
results in a dereference of a null pointer (loaded from variable 'chr')
start = chr->value_handle + 1;
^~~~~~~~~~~~~~~~~
Diffstat (limited to 'profiles')
-rw-r--r-- | profiles/input/hog-lib.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/profiles/input/hog-lib.c b/profiles/input/hog-lib.c index ace233d3c..021db386f 100644 --- a/profiles/input/hog-lib.c +++ b/profiles/input/hog-lib.c @@ -590,6 +590,9 @@ static struct report *report_new(struct bt_hog *hog, struct gatt_char *chr) struct report *report; GSList *l; + if (!chr) + return NULL; + /* Skip if report already exists */ l = g_slist_find_custom(hog->reports, chr, report_chrc_cmp); if (l) @@ -630,6 +633,9 @@ static void external_service_char_cb(uint8_t status, GSList *chars, chr = l->data; next = l->next ? l->next->data : NULL; + if (!chr) + continue; + DBG("0x%04x UUID: %s properties: %02x", chr->handle, chr->uuid, chr->properties); @@ -1232,6 +1238,9 @@ static void char_discovered_cb(uint8_t status, GSList *chars, void *user_data) chr = l->data; next = l->next ? l->next->data : NULL; + if (!chr) + continue; + DBG("0x%04x UUID: %s properties: %02x", chr->handle, chr->uuid, chr->properties); |