[PATCH BlueZ 1/3] core: Fix trying to store NULL adapter->name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux