From: Yu Watanabe Date: Fri, 9 Feb 2018 07:21:29 +0000 (+0900) Subject: sd-bus: avoid potential memory leaks X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=915d7180e74ae5a57fe19fa53fc00974ed417c5e;p=elogind.git sd-bus: avoid potential memory leaks --- diff --git a/src/libelogind/sd-bus/sd-bus.c b/src/libelogind/sd-bus/sd-bus.c index 072b3df0c..f11cdce85 100644 --- a/src/libelogind/sd-bus/sd-bus.c +++ b/src/libelogind/sd-bus/sd-bus.c @@ -22,10 +22,8 @@ #include #include #include -//#include #include #include -//#include #include #include "sd-bus.h" @@ -1109,13 +1107,6 @@ static int bus_parse_next_address(sd_bus *b) { return 1; } -static void bus_kill_exec(sd_bus *bus) { - if (pid_is_valid(bus->busexec_pid) > 0) { - sigterm_wait(bus->busexec_pid); - bus->busexec_pid = 0; - } -} - static int bus_start_address(sd_bus *b) { int r; @@ -1125,8 +1116,6 @@ static int bus_start_address(sd_bus *b) { bus_close_io_fds(b); bus_close_inotify_fd(b); - bus_kill_exec(b); - /* If you provide multiple different bus-addresses, we * try all of them in order and use the first one that * succeeds. */ @@ -1540,9 +1529,6 @@ _public_ void sd_bus_close(sd_bus *bus) { if (bus_pid_changed(bus)) return; - /* Don't leave ssh hanging around */ - bus_kill_exec(bus); - bus_set_state(bus, BUS_CLOSED); sd_bus_detach_event(bus); @@ -1560,9 +1546,6 @@ _public_ sd_bus* sd_bus_flush_close_unref(sd_bus *bus) { if (!bus) return NULL; - /* Have to do this before flush() to prevent hang */ - bus_kill_exec(bus); - sd_bus_flush(bus); sd_bus_close(bus);