From a198e765feb12cd891c049c6684c86d9d3b1983e Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sun, 16 Feb 2020 23:22:29 +0400 Subject: [PATCH] [mod_conference] Fix memory leaks and a possible deadlock in chat_send(); --- src/mod/applications/mod_conference/conference_event.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_event.c b/src/mod/applications/mod_conference/conference_event.c index 8a84fdd049..806dfc95ed 100644 --- a/src/mod/applications/mod_conference/conference_event.c +++ b/src/mod/applications/mod_conference/conference_event.c @@ -1029,17 +1029,18 @@ switch_status_t chat_send(switch_event_t *message_event) conference_list_pretty(conference, &stream); /* provide help */ } else { - return SWITCH_STATUS_SUCCESS; + goto done; } } - switch_safe_free(lbuf); - if (!conference->broadcast_chat_messages) { switch_core_chat_send_args(proto, CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", stream.data, NULL, NULL, SWITCH_FALSE); } +done: + switch_safe_free(lbuf); switch_safe_free(stream.data); + switch_thread_rwlock_unlock(conference->rwlock); return SWITCH_STATUS_SUCCESS;