summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2014-10-22 22:06:53 +0200
committerDaniel Mack <daniel@zonque.org>2014-10-22 22:06:53 +0200
commit505e77caa5cafce27b0dbfcf23e9b28315d167ae (patch)
tree2c6445020be1c4ff4f78bc9b6b44e33b6a0355ac
parent3bfd4e0c6341b0ef946d2198f089743fa99e0a97 (diff)
sd-bus: fix transition left-overs in sd_bus_get_owner_creds()
sd_bus_get_owner_creds() was only halfly ported over to _cleanup_bus_creds_unref_.
-rw-r--r--src/libsystemd/sd-bus/bus-control.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index a84b060b4f..39f4fc83a7 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -826,10 +826,8 @@ _public_ int sd_bus_get_owner_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **r
if (!isempty(bus->label) && (mask & SD_BUS_CREDS_SELINUX_CONTEXT)) {
c->label = strdup(bus->label);
- if (!c->label) {
- sd_bus_creds_unref(c);
+ if (!c->label)
return -ENOMEM;
- }
c->mask |= SD_BUS_CREDS_SELINUX_CONTEXT;
}
@@ -852,13 +850,12 @@ _public_ int sd_bus_get_owner_creds(sd_bus *bus, uint64_t mask, sd_bus_creds **r
return r;
} else {
r = bus_creds_add_more(c, mask, pid, 0);
- if (r < 0) {
- sd_bus_creds_unref(c);
+ if (r < 0)
return r;
- }
}
*ret = c;
+ c = NULL;
return 0;
}