From: Lennart Poettering Date: Thu, 17 Jan 2019 20:07:42 +0000 (+0100) Subject: sd-bus: always go through sd_bus_unref() to free messages X-Git-Tag: v242-rc1~215^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b41812d1e308de03c879cfca490105216d528c4b;p=thirdparty%2Fsystemd.git sd-bus: always go through sd_bus_unref() to free messages Don't try to be smart, don't bypass the ref counting logic if there's no real reason to. This matters if we want to tweak the ref counting logic later. --- diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 0d1d14f041b..0c3b292af83 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -136,8 +136,6 @@ static sd_bus_message* message_free(sd_bus_message *m) { return mfree(m); } -DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_message*, message_free); - static void *message_extend_fields(sd_bus_message *m, size_t align, size_t sz, bool add_offset) { void *op, *np; size_t old_size, new_size, start; @@ -529,7 +527,7 @@ int bus_message_from_malloc( const char *label, sd_bus_message **ret) { - _cleanup_(message_freep) sd_bus_message *m = NULL; + _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; size_t sz; int r; @@ -648,7 +646,7 @@ _public_ int sd_bus_message_new_method_call( const char *interface, const char *member) { - _cleanup_(message_freep) sd_bus_message *t = NULL; + _cleanup_(sd_bus_message_unrefp) sd_bus_message *t = NULL; int r; assert_return(bus, -ENOTCONN); @@ -693,7 +691,7 @@ static int message_new_reply( uint8_t type, sd_bus_message **m) { - _cleanup_(message_freep) sd_bus_message *t = NULL; + _cleanup_(sd_bus_message_unrefp) sd_bus_message *t = NULL; uint64_t cookie; int r; @@ -744,7 +742,7 @@ _public_ int sd_bus_message_new_method_error( sd_bus_message **m, const sd_bus_error *e) { - _cleanup_(message_freep) sd_bus_message *t = NULL; + _cleanup_(sd_bus_message_unrefp) sd_bus_message *t = NULL; int r; assert_return(sd_bus_error_is_set(e), -EINVAL); @@ -847,7 +845,7 @@ int bus_message_new_synthetic_error( const sd_bus_error *e, sd_bus_message **m) { - _cleanup_(message_freep) sd_bus_message *t = NULL; + _cleanup_(sd_bus_message_unrefp) sd_bus_message *t = NULL; int r; assert(bus);