From 7ae8edcd03f74da123298330b76c3fc5425042ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 18 Jul 2018 12:16:33 +0200 Subject: bus: move BUS_DONT_DESTROY calls after asserts It's not useful to bump the reference count before checking if the object is NULL. Thanks to d40f5cc498 we can do this ;). Related to https://bugzilla.redhat.com/show_bug.cgi?id=1576084, https://bugzilla.redhat.com/show_bug.cgi?id=1575340, https://bugzilla.redhat.com/show_bug.cgi?id=1575350. I'm not sure why those two people hit this code path, while most people don't. At least we won't abort. --- src/libsystemd/sd-bus/sd-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libsystemd/sd-bus/sd-bus.c') diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index deb664540a..689cbf74d3 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -2884,7 +2884,6 @@ finish: } static int bus_process_internal(sd_bus *bus, bool hint_priority, int64_t priority, sd_bus_message **ret) { - BUS_DONT_DESTROY(bus); int r; /* Returns 0 when we didn't do anything. This should cause the @@ -2900,6 +2899,8 @@ static int bus_process_internal(sd_bus *bus, bool hint_priority, int64_t priorit assert_return(!bus->current_message, -EBUSY); assert(!bus->current_slot); + BUS_DONT_DESTROY(bus); + switch (bus->state) { case BUS_UNSET: -- cgit v1.2.1