summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2014-10-09 11:26:09 +0200
committerDaniel Mack <daniel@zonque.org>2014-10-09 11:26:09 +0200
commitb1543c4c93855b61b40118e9f14a0423dac2e078 (patch)
treea8fb73196947fff3633471c98c558cb48d81807a /src
parentb923047d73f412be40ba162e0b664cff3c17a480 (diff)
sd-bus: check return value of asprintf()
Check for OOM conditions of asprintf() in bus_set_address_user().
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd/sd-bus/sd-bus.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index bc4376fb51..549f9e0943 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -1163,7 +1163,11 @@ int bus_set_address_user(sd_bus *b) {
#endif
} else {
#ifdef ENABLE_KDBUS
- asprintf(&b->address, KERNEL_USER_BUS_FMT, getuid());
+ int r;
+
+ r = asprintf(&b->address, KERNEL_USER_BUS_FMT, getuid());
+ if (r < 0)
+ return -ENOMEM;
#else
return -ECONNREFUSED;
#endif