From 67981b948d306dc67bce68bf68c27e23b6e0cefc Mon Sep 17 00:00:00 2001 From: Ivan Prisyazhnyy Date: Wed, 31 Jul 2024 14:47:46 +0200 Subject: [PATCH] macos: fix missing pthread mutex init after calloc calls constructor for a mutex in a struct value init-ed with gu_calloc. in path `gcs_core_create() -> gcs_group_init()`, the first one allocates `gcs_core_t* core` with gu_calloc() whereas `gcs_code_t` has `gcs_group_t group` with `gu::Mutex memb_mtx_`. After memory allocation gu::Mutex constructor was not called that lead to an error on Darwin in a call to pthread mutex lock. Signed-off-by: Ivan Prisyazhnyy --- gcs/src/gcs_group.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gcs/src/gcs_group.cpp b/gcs/src/gcs_group.cpp index a46b8ca57..e0c128272 100644 --- a/gcs/src/gcs_group.cpp +++ b/gcs/src/gcs_group.cpp @@ -61,6 +61,7 @@ gcs_group_init (gcs_group_t* group, gu::Config* const cnf, gcache_t* const cache int const appl_proto_ver) { // here we also create default node instance. + new (&group->memb_mtx_) gu::Mutex(NULL); group->cache = cache; group->act_id_ = GCS_SEQNO_ILL; group->conf_id = GCS_SEQNO_ILL;