mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-02-10 04:27:48 -05:00
modules: avoid some leaks in error paths
This commit is contained in:
parent
1985eb3549
commit
79b6dab5f9
2 changed files with 27 additions and 12 deletions
|
|
@ -1158,6 +1158,7 @@ static int make_socket(const struct sockaddr_storage* sa, socklen_t salen,
|
|||
|
||||
return fd;
|
||||
error:
|
||||
close(fd);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -1172,8 +1173,10 @@ static int setup_apple_session(struct impl *impl)
|
|||
impl->ctrl_source = pw_loop_add_io(impl->loop, fd,
|
||||
SPA_IO_IN, true, on_ctrl_io, impl);
|
||||
|
||||
if (impl->ctrl_source == NULL)
|
||||
if (impl->ctrl_source == NULL) {
|
||||
close(fd);
|
||||
return -errno;
|
||||
}
|
||||
|
||||
if ((fd = make_socket(&impl->data_addr, impl->data_len,
|
||||
impl->mcast_loop, impl->ttl, impl->ifname)) < 0)
|
||||
|
|
@ -1181,9 +1184,10 @@ static int setup_apple_session(struct impl *impl)
|
|||
|
||||
impl->data_source = pw_loop_add_io(impl->data_loop, fd,
|
||||
SPA_IO_IN, true, on_data_io, impl);
|
||||
if (impl->data_source == NULL)
|
||||
if (impl->data_source == NULL) {
|
||||
close(fd);
|
||||
return -errno;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue