linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name
@ 2012-12-19  1:16 Anderson Lizardo
  2012-12-19  1:16 ` [PATCH BlueZ 2/3] core: Remove bogus DBG() Anderson Lizardo
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anderson Lizardo @ 2012-12-19  1:16 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Anderson Lizardo

When BlueZ starts without a main.conf, adapter->name will be initially
NULL, until adapter_name_changed() is called and name is set to "BlueZ".

Before this, store_adapter_info() will try to access a NULL pointer.

Fixes this GLib error:

(bluetoothd:1721): GLib-CRITICAL **: g_key_file_set_string: assertion
`string != NULL' failed
---
 src/adapter.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index 9b83afe..d62b0fe 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -193,7 +193,9 @@ static void store_adapter_info(struct btd_adapter *adapter)
 
 	key_file = g_key_file_new();
 
-	g_key_file_set_string(key_file, "General", "Name", adapter->name);
+	if (adapter->name)
+		g_key_file_set_string(key_file, "General", "Name",
+								adapter->name);
 
 	g_key_file_set_boolean(key_file, "General", "Pairable",
 				adapter->pairable);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-12-19  7:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-19  1:16 [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name Anderson Lizardo
2012-12-19  1:16 ` [PATCH BlueZ 2/3] core: Remove bogus DBG() Anderson Lizardo
2012-12-19  1:16 ` [PATCH BlueZ 3/3] core: Remove reference to old "mgmtops" name Anderson Lizardo
2012-12-19  7:32 ` [PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name 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).