mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-14 08:21:47 -04:00
pipewire: check init count before loading plugins
When pw_init() was not called and the init_count is 0, the plugin path was not set and loading plugins will fail/segfault. Avoid this and return en error early instead with a message that pw_init() should be called first. See !2784
This commit is contained in:
parent
11d28c661b
commit
b12b7f785e
1 changed files with 8 additions and 0 deletions
|
|
@ -300,10 +300,18 @@ struct spa_handle *pw_load_spa_handle(const char *lib,
|
|||
const struct spa_support support[])
|
||||
{
|
||||
struct spa_handle *handle;
|
||||
struct support *sup = &global_support;
|
||||
pthread_mutex_lock(&support_lock);
|
||||
if (sup->init_count == 0)
|
||||
goto error;
|
||||
handle = load_spa_handle(lib, factory_name, info, n_support, support);
|
||||
pthread_mutex_unlock(&support_lock);
|
||||
return handle;
|
||||
error:
|
||||
pw_log_error("load lib: pw_init() was not called");
|
||||
pthread_mutex_unlock(&support_lock);
|
||||
errno = EBADFD;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct handle *find_handle(struct spa_handle *handle)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue