* [PATCH BlueZ] adapter: Fix segfault when icon is uninitialized
@ 2012-04-02 19:20 Bruna Moreira
2012-04-02 19:35 ` Johan Hedberg
2012-04-02 20:05 ` [PATCH v2 " Bruna Moreira
0 siblings, 2 replies; 4+ messages in thread
From: Bruna Moreira @ 2012-04-02 19:20 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
If device type is LE and GAP Appearance characteristic does not exist,
the icon will not be initialized.
---
src/adapter.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index f8f46f8..9ebfe66 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2664,7 +2664,7 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
{
struct btd_device *device;
char peer_addr[18], local_addr[18];
- const char *icon, *paddr = peer_addr;
+ const char *icon = NULL, *paddr = peer_addr;
dbus_bool_t paired = FALSE, trusted = FALSE;
dbus_int16_t rssi = dev->rssi;
char *alias;
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH BlueZ] adapter: Fix segfault when icon is uninitialized
2012-04-02 19:20 [PATCH BlueZ] adapter: Fix segfault when icon is uninitialized Bruna Moreira
@ 2012-04-02 19:35 ` Johan Hedberg
2012-04-02 20:05 ` [PATCH v2 " Bruna Moreira
1 sibling, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2012-04-02 19:35 UTC (permalink / raw)
To: Bruna Moreira; +Cc: linux-bluetooth
Hi Bruna,
On Mon, Apr 02, 2012, Bruna Moreira wrote:
> If device type is LE and GAP Appearance characteristic does not exist,
> the icon will not be initialized.
> ---
> src/adapter.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/adapter.c b/src/adapter.c
> index f8f46f8..9ebfe66 100644
> --- a/src/adapter.c
> +++ b/src/adapter.c
> @@ -2664,7 +2664,7 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
> {
> struct btd_device *device;
> char peer_addr[18], local_addr[18];
> - const char *icon, *paddr = peer_addr;
> + const char *icon = NULL, *paddr = peer_addr;
> dbus_bool_t paired = FALSE, trusted = FALSE;
> dbus_int16_t rssi = dev->rssi;
> char *alias;
I'd rather do this within the code than by initializing upon
declaration:
if (read_remote_appearance(&adapter->bdaddr, &dev->bdaddr,
&app) == 0)
icon = gap_appearance_to_icon(app);
+ else
+ icon = NULL;
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v2 BlueZ] adapter: Fix segfault when icon is uninitialized
2012-04-02 19:20 [PATCH BlueZ] adapter: Fix segfault when icon is uninitialized Bruna Moreira
2012-04-02 19:35 ` Johan Hedberg
@ 2012-04-02 20:05 ` Bruna Moreira
2012-04-03 9:42 ` Johan Hedberg
1 sibling, 1 reply; 4+ messages in thread
From: Bruna Moreira @ 2012-04-02 20:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Bruna Moreira
If device type is LE and GAP Appearance characteristic does not exist,
the icon will not be initialized.
---
src/adapter.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index f8f46f8..6afeaad 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2710,6 +2710,8 @@ void adapter_emit_device_found(struct btd_adapter *adapter,
if (read_remote_appearance(&adapter->bdaddr, &dev->bdaddr,
&app) == 0)
icon = gap_appearance_to_icon(app);
+ else
+ icon = NULL;
emit_device_found(adapter->path, paddr,
"Address", DBUS_TYPE_STRING, &paddr,
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-03 9:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-02 19:20 [PATCH BlueZ] adapter: Fix segfault when icon is uninitialized Bruna Moreira
2012-04-02 19:35 ` Johan Hedberg
2012-04-02 20:05 ` [PATCH v2 " Bruna Moreira
2012-04-03 9:42 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).