mirror of
https://github.com/systemd/systemd
synced 2024-07-21 10:17:21 +00:00
sd-bus: close peer pidfd
Do not leak the pidfd of the peer.
Fixes: 71be64064c
("sd-bus: add pidfd to the sd_bus_creds structure")
This commit is contained in:
parent
f5faf4ec5b
commit
9fb2db89e3
|
@ -152,6 +152,14 @@ void bus_close_inotify_fd(sd_bus *b) {
|
|||
b->n_inotify_watches = 0;
|
||||
}
|
||||
|
||||
static void bus_close_fds(sd_bus *b) {
|
||||
assert(b);
|
||||
|
||||
bus_close_io_fds(b);
|
||||
bus_close_inotify_fd(b);
|
||||
b->pidfd = safe_close(b->pidfd);
|
||||
}
|
||||
|
||||
static void bus_reset_queues(sd_bus *b) {
|
||||
assert(b);
|
||||
|
||||
|
@ -192,8 +200,7 @@ static sd_bus* bus_free(sd_bus *b) {
|
|||
if (b->default_bus_ptr)
|
||||
*b->default_bus_ptr = NULL;
|
||||
|
||||
bus_close_io_fds(b);
|
||||
bus_close_inotify_fd(b);
|
||||
bus_close_fds(b);
|
||||
|
||||
free(b->label);
|
||||
free(b->groups);
|
||||
|
@ -1126,8 +1133,7 @@ static int bus_start_address(sd_bus *b) {
|
|||
assert(b);
|
||||
|
||||
for (;;) {
|
||||
bus_close_io_fds(b);
|
||||
bus_close_inotify_fd(b);
|
||||
bus_close_fds(b);
|
||||
|
||||
bus_kill_exec(b);
|
||||
|
||||
|
@ -1802,8 +1808,7 @@ _public_ void sd_bus_close(sd_bus *bus) {
|
|||
* the bus object and the bus may be freed */
|
||||
bus_reset_queues(bus);
|
||||
|
||||
bus_close_io_fds(bus);
|
||||
bus_close_inotify_fd(bus);
|
||||
bus_close_fds(bus);
|
||||
}
|
||||
|
||||
_public_ sd_bus *sd_bus_close_unref(sd_bus *bus) {
|
||||
|
|
Loading…
Reference in a new issue