mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-03 06:47:04 -04:00
raop: handle strdup allocation error
This commit is contained in:
parent
d23ec56f0d
commit
c1f6cde926
1 changed files with 12 additions and 3 deletions
|
|
@ -531,22 +531,31 @@ int pw_rtsp_client_connect(struct pw_rtsp_client *client,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
client->source = pw_loop_add_io(client->loop, fd,
|
client->source = pw_loop_add_io(client->loop, spa_steal_fd(fd),
|
||||||
SPA_IO_IN | SPA_IO_OUT | SPA_IO_HUP | SPA_IO_ERR,
|
SPA_IO_IN | SPA_IO_OUT | SPA_IO_HUP | SPA_IO_ERR,
|
||||||
true, on_source_io, client);
|
true, on_source_io, client);
|
||||||
|
|
||||||
if (client->source == NULL) {
|
if (client->source == NULL) {
|
||||||
res = -errno;
|
res = -errno;
|
||||||
pw_log_error("%p: source create failed: %m", client);
|
pw_log_error("%p: source create failed: %m", client);
|
||||||
close(fd);
|
goto error;
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
client->connecting = true;
|
client->connecting = true;
|
||||||
free(client->session_id);
|
free(client->session_id);
|
||||||
client->session_id = strdup(session_id);
|
client->session_id = strdup(session_id);
|
||||||
|
if (client->session_id == NULL) {
|
||||||
|
res = -errno;
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
pw_log_info("%p: connecting", client);
|
pw_log_info("%p: connecting", client);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
error:
|
||||||
|
if (client->source)
|
||||||
|
pw_loop_destroy_source(client->loop, client->source);
|
||||||
|
if (fd >= 0)
|
||||||
|
close(fd);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pw_rtsp_client_disconnect(struct pw_rtsp_client *client)
|
int pw_rtsp_client_disconnect(struct pw_rtsp_client *client)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue