diff options
author | Philippe De Swert <philippedeswert@gmail.com> | 2014-09-10 12:20:38 +0300 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2014-09-11 17:09:50 +0200 |
commit | fd989a0bc999d79719408ac28b126d9c9016bcb5 (patch) | |
tree | f4cd35bf6d045cd9e45ca3221ef43bc7ae14f38c /src | |
parent | 393a5ba09f7c5360d2e5066c23d43bb82d856173 (diff) |
bus: avoid using m->kdbus after freeing it
m->kdbus could be freed before it is released. Changing the
order fixes the issue.
Found with Coverity. Fixes: CID#1237798
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd/sd-bus/bus-message.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index d00455a112..bfb14fcce6 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -127,9 +127,6 @@ static void message_free(sd_bus_message *m) { message_reset_parts(m); - if (m->free_kdbus) - free(m->kdbus); - if (m->release_kdbus) { uint64_t off; @@ -137,6 +134,9 @@ static void message_free(sd_bus_message *m) { ioctl(m->bus->input_fd, KDBUS_CMD_FREE, &off); } + if (m->free_kdbus) + free(m->kdbus); + sd_bus_unref(m->bus); if (m->free_fds) { |