[PATCH] Fix GLib assertion failure in media.c get_setting()

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

 



If get_setting is called before set_setting, mp->settings would be
NULL resulting in GLib assertion. Hashmap is now allocated in
media_player_create instead of on-demand allocation in set_setting.

external/bluetooth/bluez/audio/media.c:get_setting() Equalizer
CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed
---
 audio/media.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/audio/media.c b/audio/media.c
index a363b8e..c0fd0c3 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -1371,9 +1371,6 @@ static gboolean set_property(struct media_player *mp, const char *key,
 
 	DBG("%s=%s", key, value);
 
-	if (!mp->settings)
-		mp->settings = g_hash_table_new(g_direct_hash, g_direct_equal);
-
 	g_hash_table_replace(mp->settings, GUINT_TO_POINTER(attr),
 						GUINT_TO_POINTER(val));
 
@@ -1595,6 +1592,8 @@ static struct media_player *media_player_create(struct media_adapter *adapter,
 		return NULL;
 	}
 
+	mp->settings = g_hash_table_new(g_direct_hash, g_direct_equal);
+
 	adapter->players = g_slist_append(adapter->players, mp);
 
 	info("Player registered: sender=%s path=%s", sender, path);
-- 
on behalf of ST-Ericsson


--
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