Skip to content

Commit

Permalink
client/advertising: Fixes errors found by scan-build
Browse files Browse the repository at this point in the history
This fixes the following errors:

client/advertising.c:129:4: warning: Value stored to 'n' is never read
[deadcode.DeadStores]
                        n = sizeof(str) - 1;
                        ^   ~~~~~~~~~~~~~~~
client/advertising.c:1012:25: warning: Dereference of null pointer
(loaded from variable 'min') [core.NullDereference]
        if (ad.min_interval != *min) {
                               ^~~~
  • Loading branch information
Vudentz committed Jun 22, 2022
1 parent 33c96ca commit 7f92f75
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions client/advertising.c
Expand Up @@ -125,8 +125,6 @@ static void print_uuid(const char *uuid)
str[sizeof(str) - 3] = '.';
if (str[sizeof(str) - 4] == ' ')
str[sizeof(str) - 4] = '.';

n = sizeof(str) - 1;
}

bt_shell_printf("UUID: %s(%s)\n", str, uuid);
Expand Down Expand Up @@ -1009,13 +1007,13 @@ void ad_advertise_interval(DBusConnection *conn, uint32_t *min, uint32_t *max)
return bt_shell_noninteractive_quit(EXIT_SUCCESS);
}

if (ad.min_interval != *min) {
if (min && ad.min_interval != *min) {
ad.min_interval = *min;
g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE,
"MinInterval");
}

if (ad.max_interval != *max) {
if (max && ad.max_interval != *max) {
ad.max_interval = *max;
g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE,
"MaxInterval");
Expand Down

0 comments on commit 7f92f75

Please sign in to comment.