diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-01-17 21:06:30 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-03-01 15:19:45 +0100 |
commit | 2fe9a10d7695c4c3a748969a0d1662c624e50e5e (patch) | |
tree | 82390b90742fb03e9495d171c86517cc4bb7d8b3 /src/libsystemd | |
parent | test: fix indenting off by one (diff) | |
download | systemd-2fe9a10d7695c4c3a748969a0d1662c624e50e5e.tar.xz systemd-2fe9a10d7695c4c3a748969a0d1662c624e50e5e.zip |
sd-bus: initialize mutex after we allocated the wqueue
That way the mutex doesn't have to be destroyed when we exit early due
to OOM.
Diffstat (limited to 'src/libsystemd')
-rw-r--r-- | src/libsystemd/sd-bus/sd-bus.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index 9eeb3c448c..0df3366d80 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -248,12 +248,12 @@ _public_ int sd_bus_new(sd_bus **ret) { .close_on_exit = true, }; - assert_se(pthread_mutex_init(&b->memfd_cache_mutex, NULL) == 0); - /* We guarantee that wqueue always has space for at least one entry */ if (!GREEDY_REALLOC(b->wqueue, b->wqueue_allocated, 1)) return -ENOMEM; + assert_se(pthread_mutex_init(&b->memfd_cache_mutex, NULL) == 0); + *ret = TAKE_PTR(b); return 0; } |