mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-05 06:46:28 -04:00
bluez5: handle some allocation failures
This commit is contained in:
parent
6539c2bf8c
commit
057ae16504
2 changed files with 12 additions and 1 deletions
|
|
@ -3505,6 +3505,10 @@ static DBusHandlerResult profile_new_connection(DBusConnection *conn, DBusMessag
|
|||
rfcomm->profile = profile;
|
||||
rfcomm->device = d;
|
||||
rfcomm->path = strdup(path);
|
||||
if (rfcomm->path == NULL) {
|
||||
free(rfcomm);
|
||||
return DBUS_HANDLER_RESULT_NEED_MEMORY;
|
||||
}
|
||||
rfcomm->source.func = rfcomm_event;
|
||||
rfcomm->source.data = rfcomm;
|
||||
rfcomm->source.fd = spa_steal_fd(fd);
|
||||
|
|
|
|||
|
|
@ -3497,8 +3497,15 @@ filter_bluez_device_setting(struct impl *this, const struct spa_dict *dict)
|
|||
{
|
||||
const struct spa_dict_item *it = &dict->items[i];
|
||||
if (it->key != NULL && strncmp(it->key, "bluez", 5) == 0 && it->value != NULL) {
|
||||
char *key = strdup(it->key);
|
||||
char *value = strdup(it->value);
|
||||
if (key == NULL || value == NULL) {
|
||||
free(key);
|
||||
free(value);
|
||||
continue;
|
||||
}
|
||||
this->setting_items[n_items++] =
|
||||
SPA_DICT_ITEM_INIT(strdup(it->key), strdup(it->value));
|
||||
SPA_DICT_ITEM_INIT(key, value);
|
||||
}
|
||||
}
|
||||
this->setting_dict = SPA_DICT_INIT(this->setting_items, n_items);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue