[pulseaudio-discuss] [PATCHv2 37/60] bluetooth: Parse BlueZ 5 adapter properties
João Paulo Rechi Vita
jprvita at gmail.com
Wed Sep 4 13:00:10 PDT 2013
On Sun, Aug 18, 2013 at 8:40 AM, Tanu Kaskinen
<tanu.kaskinen at linux.intel.com> wrote:
> On Tue, 2013-08-13 at 01:54 -0300, jprvita at gmail.com wrote:
>> +static int parse_adapter_properties(pa_bluetooth_discovery *y, const char *adapter, DBusMessageIter *i) {
>> + DBusMessageIter element_i;
>> +
>> + pa_assert(y);
>> + pa_assert(adapter);
>> +
>> + dbus_message_iter_recurse(i, &element_i);
>> +
>> + while (dbus_message_iter_get_arg_type(&element_i) == DBUS_TYPE_DICT_ENTRY) {
>> + DBusMessageIter dict_i, variant_i;
>> + const char *key;
>> +
>> + dbus_message_iter_recurse(&element_i, &dict_i);
>> +
>> + key = check_variant_property(&dict_i);
>> + if (key == NULL) {
>> + pa_log_error("Received invalid property for adapter %s", adapter);
>> + return -1;
>> + }
>> +
>> + dbus_message_iter_recurse(&dict_i, &variant_i);
>> +
>> + if (dbus_message_iter_get_arg_type(&variant_i) == DBUS_TYPE_STRING && pa_streq(key, "Address")) {
>> + char *value;
>> + pa_bluetooth_adapter *a = pa_xnew(pa_bluetooth_adapter, 1);
>> +
>> + dbus_message_iter_get_basic(&variant_i, &value);
>> + a->path = pa_xstrdup(adapter);
>> + a->address = pa_xstrdup(value);
>> + pa_hashmap_put(y->adapters, a->path, a);
>
> This leaks pa_bluetooth_adapter objects if bluetoothd sends duplicate
> addresses. pa_bluetooth_adapter creation should be handled in the same
> way as pa_bluetooth_device creation.
>
Yes, you're right, I'm changing that for v3.
--
João Paulo Rechi Vita
http://about.me/jprvita
More information about the pulseaudio-discuss
mailing list