diff --git a/src/XMPPThread/ReListener.c b/src/XMPPThread/ReListener.c index 62ff10b..04cae69 100644 --- a/src/XMPPThread/ReListener.c +++ b/src/XMPPThread/ReListener.c @@ -331,6 +331,7 @@ ParseeAwaitStanza(char *identifier, int64_t timeout) { /* Timeout detected, give up regardless of the status of our * search. */ + pthread_mutex_lock(&await_lock); HashMapDelete(await_table, identifier); pthread_mutex_unlock(&await_lock); break; @@ -344,7 +345,9 @@ ParseeAwaitStanza(char *identifier, int64_t timeout) stanza = awa.stanza; pthread_mutex_unlock(&awa.cond_lock); + pthread_mutex_lock(&await_lock); pthread_cond_destroy(&awa.condition); pthread_mutex_destroy(&awa.cond_lock); + pthread_mutex_unlock(&await_lock); return stanza; }