diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-03-04 09:20:51 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-03-04 10:04:50 -0500 |
commit | 6e18964d3a365567954fe10ddcfad74babdc427c (patch) | |
tree | a1e62c233e0cac0224623049e6fb98b8e450d0ac /src/libsystemd/sd-bus | |
parent | e062dec5ae1a443d47885537af85d328c83c67db (diff) |
Introduce strv_consume which takes ownership
This mirrors set_consume and makes the common use a bit nicer.
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r-- | src/libsystemd/sd-bus/bus-control.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c index 22b95d589d..db0c11b0fe 100644 --- a/src/libsystemd/sd-bus/bus-control.c +++ b/src/libsystemd/sd-bus/bus-control.c @@ -237,11 +237,9 @@ static int kernel_get_list(sd_bus *bus, uint64_t flags, char ***x) { if (asprintf(&n, ":1.%llu", (unsigned long long) name->owner_id) < 0) return -ENOMEM; - r = strv_push(x, n); - if (r < 0) { - free(n); - return -ENOMEM; - } + r = strv_consume(x, n); + if (r < 0) + return r; previous_id = name->owner_id; } |