diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2016-10-29 21:06:53 +0300 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2017-03-30 19:27:02 +0300 |
commit | 41e974d8631541164d6811fc68f7ff21e5ed322a (patch) | |
tree | 1e958035971c07c7a59c23ee3f80653851b05045 /src | |
parent | 2c2ca1c949553b59c54431ec179b31a697004492 (diff) |
bluetooth: assert that dbus_message_iter_append_basic() doesn't fail
The function can only fail if there's not enough memory available, and
if that happens, the convention in PulseAudio is to abort.
CID: 1353106, 1353108, 1353140
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/bluetooth/backend-native.c | 4 | ||||
-rw-r--r-- | src/modules/bluetooth/bluez4-util.c | 4 | ||||
-rw-r--r-- | src/modules/bluetooth/bluez5-util.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/modules/bluetooth/backend-native.c b/src/modules/bluetooth/backend-native.c index e6bf6fed..6eb4e168 100644 --- a/src/modules/bluetooth/backend-native.c +++ b/src/modules/bluetooth/backend-native.c @@ -331,8 +331,8 @@ static void register_profile(pa_bluetooth_backend *b, const char *profile, const pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, "/org/bluez", BLUEZ_PROFILE_MANAGER_INTERFACE, "RegisterProfile")); dbus_message_iter_init_append(m, &i); - dbus_message_iter_append_basic(&i, DBUS_TYPE_OBJECT_PATH, &profile); - dbus_message_iter_append_basic(&i, DBUS_TYPE_STRING, &uuid); + pa_assert_se(dbus_message_iter_append_basic(&i, DBUS_TYPE_OBJECT_PATH, &profile)); + pa_assert_se(dbus_message_iter_append_basic(&i, DBUS_TYPE_STRING, &uuid)); dbus_message_iter_open_container(&i, DBUS_TYPE_ARRAY, DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &d); if (pa_streq (uuid, PA_BLUETOOTH_UUID_HSP_HS)) { diff --git a/src/modules/bluetooth/bluez4-util.c b/src/modules/bluetooth/bluez4-util.c index 542ce35e..06108f4b 100644 --- a/src/modules/bluetooth/bluez4-util.c +++ b/src/modules/bluetooth/bluez4-util.c @@ -792,7 +792,7 @@ static void register_endpoint(pa_bluez4_discovery *y, const char *path, const ch dbus_message_iter_init_append(m, &i); - dbus_message_iter_append_basic(&i, DBUS_TYPE_OBJECT_PATH, &endpoint); + pa_assert_se(dbus_message_iter_append_basic(&i, DBUS_TYPE_OBJECT_PATH, &endpoint)); dbus_message_iter_open_container(&i, DBUS_TYPE_ARRAY, DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, @@ -1175,7 +1175,7 @@ static void set_property(pa_bluez4_discovery *y, const char *bus, const char *pa pa_assert_se(m = dbus_message_new_method_call(bus, path, interface, "SetProperty")); dbus_message_iter_init_append(m, &i); - dbus_message_iter_append_basic(&i, DBUS_TYPE_STRING, &prop_name); + pa_assert_se(dbus_message_iter_append_basic(&i, DBUS_TYPE_STRING, &prop_name)); pa_dbus_append_basic_variant(&i, prop_type, prop_value); dbus_message_set_no_reply(m, true); diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c index 8e50e0be..23100fca 100644 --- a/src/modules/bluetooth/bluez5-util.c +++ b/src/modules/bluetooth/bluez5-util.c @@ -886,7 +886,7 @@ static void register_endpoint(pa_bluetooth_discovery *y, const char *path, const pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, path, BLUEZ_MEDIA_INTERFACE, "RegisterEndpoint")); dbus_message_iter_init_append(m, &i); - dbus_message_iter_append_basic(&i, DBUS_TYPE_OBJECT_PATH, &endpoint); + pa_assert_se(dbus_message_iter_append_basic(&i, DBUS_TYPE_OBJECT_PATH, &endpoint)); dbus_message_iter_open_container(&i, DBUS_TYPE_ARRAY, DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &d); pa_dbus_append_basic_variant_dict_entry(&d, "UUID", DBUS_TYPE_STRING, &uuid); |