mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
module: handle work queue create errors
Handle NULL when creating a work queue instead of crashing. The create can fail when we run out of fds.
This commit is contained in:
parent
bbbc79647f
commit
1f04e911c5
7 changed files with 49 additions and 8 deletions
|
|
@ -500,6 +500,7 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
struct pw_context *context = pw_impl_module_get_context(module);
|
||||
struct pw_impl_factory *factory;
|
||||
struct factory_data *data;
|
||||
int res;
|
||||
|
||||
factory = pw_context_create_factory(context,
|
||||
"link-factory",
|
||||
|
|
@ -516,6 +517,13 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
data->this = factory;
|
||||
data->module = module;
|
||||
data->work = pw_context_get_work_queue(context);
|
||||
if (data->work == NULL) {
|
||||
res = -errno;
|
||||
pw_log_error( "can't get work queue: %m");
|
||||
pw_impl_factory_destroy(factory);
|
||||
return res;
|
||||
}
|
||||
|
||||
spa_list_init(&data->link_list);
|
||||
|
||||
pw_log_debug("module %p: new", module);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue