From 6c7d785d6649764b641b86d429c164d5247b25e8 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Mon, 14 Oct 2024 22:09:17 +0300 Subject: [PATCH] fix(sanitizer): fix thread issues reported by the sanitizer --- core/pbcc_subscribe_event_engine.c | 1 + core/pbcc_subscribe_event_listener.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/core/pbcc_subscribe_event_engine.c b/core/pbcc_subscribe_event_engine.c index 5370f72e..7369762f 100644 --- a/core/pbcc_subscribe_event_engine.c +++ b/core/pbcc_subscribe_event_engine.c @@ -215,6 +215,7 @@ pbcc_subscribe_ee_t* pbcc_subscribe_ee_alloc(pubnub_t* pb) PBARRAY_CHAR_CONTENT_TYPE, (pbarray_element_free)free); ee->current_transaction = PBTT_NONE; + ee->cancel_invocation = NULL; pubnub_mutex_init(ee->mutw); if (NULL == ee->subscriptions) { diff --git a/core/pbcc_subscribe_event_listener.c b/core/pbcc_subscribe_event_listener.c index 6b72b304..30d23e34 100644 --- a/core/pbcc_subscribe_event_listener.c +++ b/core/pbcc_subscribe_event_listener.c @@ -252,6 +252,9 @@ pbcc_event_listener_t* pbcc_event_listener_alloc(const pubnub_t* pb) { PBCC_ALLOCATE_TYPE(listener, pbcc_event_listener_t, true, NULL); pubnub_mutex_init(listener->mutw); + listener->global_events = NULL; + listener->global_status = NULL; + listener->listeners = NULL; listener->pb = pb; return listener; @@ -513,6 +516,7 @@ pbcc_object_listener_t* pbcc_object_listener_alloc_(char* name) { PBCC_ALLOCATE_TYPE(updates, pbcc_object_listener_t, true, NULL); updates->name = name; + updates->listeners = NULL; pbcc_initialize_array_( &updates->listeners, (pbarray_element_free)pbcc_listener_free_);