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.
This commit is contained in:
parent
8f37636d91
commit
2fe9a10d76
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue