summaryrefslogtreecommitdiffstats
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2013-04-12 20:08:28 +0200
committerKay Sievers <kay@vrfy.org>2013-04-12 20:08:28 +0200
commit8e7382422c01dc0c19dc3c35a6144fa703ba34ee (patch)
tree3cb5d9ee82a58f6d735c800b76491a9fd782d926 /src/libsystemd-bus
parentbus: create kdbus bus without an active policy (diff)
downloadsystemd-8e7382422c01dc0c19dc3c35a6144fa703ba34ee.tar.xz
systemd-8e7382422c01dc0c19dc3c35a6144fa703ba34ee.zip
bus: align the buffer we pass to the kernel
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/bus-kernel.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index 2b3f46a64b..d5152ec6d2 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -109,7 +109,7 @@ static int bus_message_setup_kmsg(sd_bus_message *m) {
sz += ALIGN8(offsetof(struct kdbus_msg, data) + dl + 1);
}
- m->kdbus = malloc0(sz);
+ m->kdbus = aligned_alloc(8, sz);
if (!m->kdbus)
return -ENOMEM;
@@ -355,10 +355,11 @@ int bus_kernel_read_message(sd_bus *bus, sd_bus_message **m) {
for (;;) {
void *q;
- q = realloc(bus->rbuffer, sz);
+ q = aligned_alloc(8, sz);
if (!q)
return -errno;
+ free(bus->rbuffer);
k = bus->rbuffer = q;
k->size = sz;