From 5eb5ea3473395957c3e5d5cb32123ec9ffc35886 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Thu, 15 Dec 2016 15:25:49 +0100 Subject: [PATCH] Fixed RTT character not being freed correctly + RTT test with SRTP failing if SRTP not available --- coreapi/chat.c | 8 ++++---- tester/message_tester.c | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/coreapi/chat.c b/coreapi/chat.c index 076ff1489..86005269e 100644 --- a/coreapi/chat.c +++ b/coreapi/chat.c @@ -114,6 +114,9 @@ BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneChatMessage); static void _linphone_chat_room_destroy(LinphoneChatRoom *cr) { bctbx_list_free_with_data(cr->transient_messages, (void (*)(void *))linphone_chat_message_release); + if (cr->received_rtt_characters) { + cr->received_rtt_characters = bctbx_list_free_with_data(cr->received_rtt_characters, (void (*)(void *))ms_free); + } linphone_chat_room_delete_composing_idle_timer(cr); linphone_chat_room_delete_composing_refresh_timer(cr); linphone_chat_room_delete_remote_composing_refresh_timer(cr); @@ -292,9 +295,6 @@ static void linphone_chat_room_delete_remote_composing_refresh_timer(LinphoneCha } void linphone_chat_room_destroy(LinphoneChatRoom *cr) { - if (cr->received_rtt_characters) { - cr->received_rtt_characters = bctbx_list_free(cr->received_rtt_characters); - } linphone_chat_room_unref(cr); } @@ -969,7 +969,7 @@ void linphone_core_real_time_text_received(LinphoneCore *lc, LinphoneChatRoom *c linphone_chat_room_message_received(cr, lc, msg); linphone_chat_message_unref(msg); cr->pending_message = NULL; - cr->received_rtt_characters = bctbx_list_free(cr->received_rtt_characters); + cr->received_rtt_characters = bctbx_list_free_with_data(cr->received_rtt_characters, (void (*)(void *))ms_free); } else { char *value = utf8_to_char(character); cr->pending_message->message = ms_strcat_printf(cr->pending_message->message, value); diff --git a/tester/message_tester.c b/tester/message_tester.c index a00e79710..1e32f2b10 100644 --- a/tester/message_tester.c +++ b/tester/message_tester.c @@ -1593,6 +1593,10 @@ static void real_time_text(bool_t audio_stream_enabled, bool_t srtp_enabled, boo } if (srtp_enabled) { + if (!ms_srtp_supported()) { + ms_warning("test skipped, missing srtp support"); + goto srtp_end; + } BC_ASSERT_TRUE(linphone_core_media_encryption_supported(marie->lc, LinphoneMediaEncryptionSRTP)); linphone_core_set_media_encryption(marie->lc, LinphoneMediaEncryptionSRTP); linphone_core_set_media_encryption(pauline->lc, LinphoneMediaEncryptionSRTP); @@ -1672,6 +1676,7 @@ end: end_call(marie, pauline); } linphone_call_params_destroy(marie_params); +srtp_end: linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); remove(marie_db);