mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -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
|
|
@ -172,7 +172,8 @@ static void impl_free(struct impl *impl)
|
|||
if (impl->avahi_poll)
|
||||
pw_avahi_poll_free(impl->avahi_poll);
|
||||
pw_properties_free(impl->properties);
|
||||
pw_work_queue_cancel(impl->work, impl, SPA_ID_INVALID);
|
||||
if (impl->work)
|
||||
pw_work_queue_cancel(impl->work, impl, SPA_ID_INVALID);
|
||||
free(impl);
|
||||
}
|
||||
|
||||
|
|
@ -490,9 +491,12 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
|
||||
impl->module = module;
|
||||
impl->context = context;
|
||||
impl->work = pw_context_get_work_queue(context);
|
||||
impl->properties = props;
|
||||
|
||||
impl->work = pw_context_get_work_queue(context);
|
||||
if (impl->work == NULL)
|
||||
goto error_errno;
|
||||
|
||||
pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl);
|
||||
|
||||
pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props));
|
||||
|
|
@ -503,6 +507,6 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
|
||||
error_errno:
|
||||
res = -errno;
|
||||
free(impl);
|
||||
impl_free(impl);
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue