diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-10-03 19:47:47 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-10-03 20:42:09 -0400 |
commit | 125dd07483b6836106ff9ad3ce1737d8a6c56c59 (patch) | |
tree | 17947bb2e264b02e26ac7322e28c84164fe96db3 /src/libsystemd/sd-bus | |
parent | d267c5aa3d0fe4960165a1e1c00a840eef8b7d00 (diff) |
sd-bus: split out cleanup into separate function
m is always non-null at this point. This function is too long anyway.
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index 0c39e22ed7..09ff25fe71 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -332,6 +332,18 @@ fail: return r; } +static void unset_memfds(struct sd_bus_message *m) { + struct bus_body_part *part; + unsigned i; + + assert(m); + + /* Make sure the memfds are not freed twice */ + MESSAGE_FOREACH_PART(part, i, m) + if (part->memfd >= 0) + part->memfd = -1; +} + static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { sd_bus_message *m = NULL; struct kdbus_item *d; @@ -627,17 +639,8 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { return 1; fail: - if (m) { - struct bus_body_part *part; - unsigned i; - - /* Make sure the memfds are not freed twice */ - MESSAGE_FOREACH_PART(part, i, m) - if (part->memfd >= 0) - part->memfd = -1; - - sd_bus_message_unref(m); - } + unset_memfds(m); + sd_bus_message_unref(m); return r; } |