mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-03 06:47:04 -04:00
security: fix error path resource leaks in netjack2 manager
Fix handle_follower_available to properly clean up on all error paths after the follower has been added to the list. Add missing NULL checks for pw_properties_copy and check the netjack2_init return value. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
4ac5364004
commit
593132e434
1 changed files with 11 additions and 2 deletions
|
|
@ -982,10 +982,16 @@ static int handle_follower_available(struct impl *impl, struct nj2_session_param
|
|||
follower->sink.direction = PW_DIRECTION_INPUT;
|
||||
follower->sink.props = pw_properties_copy(impl->sink_props);
|
||||
|
||||
if (follower->source.props == NULL || follower->sink.props == NULL) {
|
||||
res = -errno;
|
||||
pw_log_error("can't create properties: %m");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if ((res = parse_audio_info(follower->source.props, &follower->source.info)) < 0 ||
|
||||
(res = parse_audio_info(follower->sink.props, &follower->sink.info)) < 0) {
|
||||
pw_log_error("can't parse format: %s", spa_strerror(res));
|
||||
return res;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
follower->source.n_audio = pw_properties_get_uint32(follower->source.props,
|
||||
|
|
@ -1117,7 +1123,10 @@ static int handle_follower_available(struct impl *impl, struct nj2_session_param
|
|||
peer->send_volume = &follower->sink.volume;
|
||||
peer->recv_volume = &follower->source.volume;
|
||||
peer->quantum_limit = impl->quantum_limit;
|
||||
netjack2_init(peer);
|
||||
if ((res = netjack2_init(peer)) < 0) {
|
||||
pw_log_error("can't init peer: %s", spa_strerror(res));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
int bufsize = SPA_MIN((size_t)NETWORK_MAX_LATENCY * (peer->params.mtu +
|
||||
(size_t)follower->period_size * sizeof(float) *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue