mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-26 13:44:23 +08:00
tools: Fix possible uninitialized variable in obexctl
On set_default_session(), if g_dbus_proxy_get_property() returns FALSE, desc will be uninitialized. Given that this function already checks for NULL proxy internally, it is enough to check whether it fails (and if so, set a default prompt without destination). Fixes this clang error: tools/obexctl.c:439:6: error: variable 'desc' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
This commit is contained in:
parent
57207bf438
commit
ff0afe7b7f
@ -431,14 +431,12 @@ static void set_default_session(GDBusProxy *proxy)
|
||||
|
||||
default_session = proxy;
|
||||
|
||||
if (proxy == NULL) {
|
||||
if (!g_dbus_proxy_get_property(proxy, "Destination", &iter)) {
|
||||
desc = g_strdup(PROMPT_ON);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (g_dbus_proxy_get_property(proxy, "Destination", &iter))
|
||||
dbus_message_iter_get_basic(&iter, &desc);
|
||||
|
||||
dbus_message_iter_get_basic(&iter, &desc);
|
||||
desc = g_strdup_printf(COLOR_BLUE "[%s]" COLOR_OFF "# ", desc);
|
||||
|
||||
done:
|
||||
|
Loading…
Reference in New Issue
Block a user