From 6e18964d3a365567954fe10ddcfad74babdc427c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 4 Mar 2014 09:20:51 -0500 Subject: Introduce strv_consume which takes ownership This mirrors set_consume and makes the common use a bit nicer. --- src/machine/machine-dbus.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/machine') diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c index df96ccf9d..c9e3bb7c7 100644 --- a/src/machine/machine-dbus.c +++ b/src/machine/machine-dbus.c @@ -225,11 +225,9 @@ int machine_node_enumerator(sd_bus *bus, const char *path, void *userdata, char if (!p) return -ENOMEM; - r = strv_push(&l, p); - if (r < 0) { - free(p); + r = strv_consume(&l, p); + if (r < 0) return r; - } } *nodes = l; -- cgit v1.2.3