mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
global: handle id allocation errors
This commit is contained in:
parent
892f27ded3
commit
e241febe62
1 changed files with 6 additions and 1 deletions
|
|
@ -98,12 +98,17 @@ pw_global_new(struct pw_context *context,
|
||||||
spa_list_init(&this->resource_list);
|
spa_list_init(&this->resource_list);
|
||||||
spa_hook_list_init(&this->listener_list);
|
spa_hook_list_init(&this->listener_list);
|
||||||
|
|
||||||
pw_context_add_global(context, this);
|
if (pw_context_add_global(context, this) == SPA_ID_INVALID) {
|
||||||
|
res = -ENOMEM;
|
||||||
|
goto error_free;
|
||||||
|
}
|
||||||
|
|
||||||
pw_log_debug("%p: new %s %d", this, this->type, this->id);
|
pw_log_debug("%p: new %s %d", this, this->type, this->id);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
|
error_free:
|
||||||
|
free(this);
|
||||||
error_cleanup:
|
error_cleanup:
|
||||||
pw_properties_free(properties);
|
pw_properties_free(properties);
|
||||||
errno = -res;
|
errno = -res;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue