mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
spa: audiotestsrc: Validate loop and system before using them
Makes sure we don't crash if those are not available (like with DataSystem under spa-inspect). Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4365
This commit is contained in:
parent
f40bfb587d
commit
41b5c50c86
1 changed files with 10 additions and 0 deletions
|
|
@ -1046,8 +1046,18 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this = (struct impl *) handle;
|
||||
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
|
||||
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||
if (this->data_loop == NULL) {
|
||||
spa_log_error(this->log, "%p: could not find a data loop", this);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||
if (this->data_system == NULL) {
|
||||
spa_log_error(this->log, "%p: could not find a data system", this);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
for (i = 0; info && i < info->n_items; i++) {
|
||||
const char *k = info->items[i].key;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue