mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-30 06:46:49 -04:00
security: fix missing NULL check after strdup in module-raop-discover
Memory Safety: Medium strdup() can return NULL on allocation failure. The return value was used without checking, which would cause a NULL pointer dereference (crash) when the name is later compared with spa_streq(). Add a NULL check and free the partially-allocated struct on failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
15c32c66f0
commit
ca0fa1e4e1
1 changed files with 4 additions and 0 deletions
|
|
@ -147,6 +147,10 @@ static struct tunnel *tunnel_new(struct impl *impl, const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
t->name = strdup(name);
|
t->name = strdup(name);
|
||||||
|
if (t->name == NULL) {
|
||||||
|
free(t);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
spa_list_append(&impl->tunnel_list, &t->link);
|
spa_list_append(&impl->tunnel_list, &t->link);
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue