mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-26 21:38:23 -04:00
modules: handle allocation errors
This commit is contained in:
parent
a55546c9df
commit
6f6b58785e
5 changed files with 29 additions and 1 deletions
|
|
@ -100,6 +100,8 @@ struct tunnel {
|
|||
struct spa_hook module_listener;
|
||||
};
|
||||
|
||||
static void tunnel_free(struct tunnel *t);
|
||||
|
||||
static struct tunnel *tunnel_new(struct impl *impl, const struct tunnel_info *info)
|
||||
{
|
||||
struct tunnel *t;
|
||||
|
|
@ -112,6 +114,11 @@ static struct tunnel *tunnel_new(struct impl *impl, const struct tunnel_info *in
|
|||
t->info.mode = strdup(info->mode);
|
||||
spa_list_append(&impl->tunnel_list, &t->link);
|
||||
|
||||
if (t->info.name == NULL || t->info.mode == NULL) {
|
||||
tunnel_free(t);
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue