mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-06 06:46:29 -04:00
modules: handle allocation errors gracefully
This commit is contained in:
parent
24f9b9a335
commit
dd695ee5a7
6 changed files with 35 additions and 4 deletions
|
|
@ -2015,6 +2015,8 @@ static int port_set_peer_enum_format(void *object,
|
|||
if (formats) {
|
||||
uint32_t count = 0;
|
||||
port->peer_format_pod = spa_pod_copy(formats);
|
||||
if (port->peer_format_pod == NULL)
|
||||
return -errno;
|
||||
|
||||
for (i = 0; i < SPA_N_ELEMENTS(subtypes); i++) {
|
||||
state = NULL;
|
||||
|
|
@ -2028,6 +2030,8 @@ static int port_set_peer_enum_format(void *object,
|
|||
}
|
||||
}
|
||||
port->peer_formats = calloc(count, sizeof(struct spa_pod *));
|
||||
if (port->peer_formats == NULL)
|
||||
return -errno;
|
||||
for (i = 0; i < SPA_N_ELEMENTS(subtypes); i++) {
|
||||
state = NULL;
|
||||
while (spa_peer_param_parse(port->peer_format_pod, &info, sizeof(info), &state) > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue