diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2015-07-02 12:14:27 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-03-14 10:05:54 +0100 |
commit | d77c6e258b8768f1ec7f85b2f7ec802428a56ae4 (patch) | |
tree | 09c93e0b8096438f7887b9977c51cd70777488c6 /src | |
parent | f03a8ebfc1c4acf74491ebd8ef5555a7f10f92c2 (diff) |
sd-bus: don't leak kdbus notifications
When we get notifications from the kernel, we always turn them into
synthetic dbus1 messages. This means, we do *not* consume the kdbus
message, and as such have to free the offset.
Right now, the translation-helpers told the caller that they consumed the
message, which is wrong. Fix this by explicitly releasing all kernel
messages that are translated.
Diffstat (limited to 'src')
-rw-r--r-- | src/libelogind/sd-bus/bus-kernel.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libelogind/sd-bus/bus-kernel.c b/src/libelogind/sd-bus/bus-kernel.c index f08db2da8..e3fac01f9 100644 --- a/src/libelogind/sd-bus/bus-kernel.c +++ b/src/libelogind/sd-bus/bus-kernel.c @@ -1385,15 +1385,16 @@ int bus_kernel_read_message(sd_bus *bus, bool hint_priority, int64_t priority) { r = 0; } - } else if (k->payload_type == KDBUS_PAYLOAD_KERNEL) + if (r <= 0) + close_kdbus_msg(bus, k); + } else if (k->payload_type == KDBUS_PAYLOAD_KERNEL) { r = bus_kernel_translate_message(bus, k); - else { + close_kdbus_msg(bus, k); + } else { log_debug("Ignoring message with unknown payload type %llu.", (unsigned long long) k->payload_type); r = 0; - } - - if (r <= 0) close_kdbus_msg(bus, k); + } return r < 0 ? r : 1; } |