Commit bd0061f2 authored by Simon Morlat's avatar Simon Morlat

fix memory leak and add new test to check that linphone_core_destroy() sends...

fix memory leak and add new test to check that linphone_core_destroy() sends BYE for unterminated calls.
parent fd2b0dfa
......@@ -1460,6 +1460,7 @@ static void linphone_core_register_static_payloads(LinphoneCore *lc){
static void linphone_core_free_payload_types(LinphoneCore *lc){
ms_list_free_with_data(lc->default_audio_codecs, (void (*)(void*))payload_type_destroy);
ms_list_free_with_data(lc->default_video_codecs, (void (*)(void*))payload_type_destroy);
ms_list_free_with_data(lc->default_text_codecs, (void (*)(void*))payload_type_destroy);
}
void linphone_core_set_state(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message){
......@@ -6257,6 +6258,7 @@ static void codecs_config_uninit(LinphoneCore *lc)
_linphone_core_codec_config_write(lc);
ms_list_free_with_data(lc->codecs_conf.audio_codecs, (void (*)(void*))payload_type_destroy);
ms_list_free_with_data(lc->codecs_conf.video_codecs, (void (*)(void*))payload_type_destroy);
ms_list_free_with_data(lc->codecs_conf.text_codecs, (void (*)(void*))payload_type_destroy);
}
void ui_config_uninit(LinphoneCore* lc)
......
......@@ -411,6 +411,28 @@ static void simple_call() {
simple_call_base(FALSE);
}
static void automatic_call_termination() {
LinphoneCoreManager* marie;
LinphoneCoreManager* pauline;
marie = linphone_core_manager_new( "marie_rc");
pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
if (!BC_ASSERT_TRUE(call(marie,pauline))) goto end;
liblinphone_tester_check_rtcp(marie,pauline);
linphone_core_destroy(pauline->lc);
pauline->lc = NULL;
/*marie shall receive the BYE*/
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1));
end:
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
}
static void call_with_timeouted_bye(void) {
LinphoneCoreManager* marie;
LinphoneCoreManager* pauline;
......@@ -4950,6 +4972,7 @@ test_t call_tests[] = {
{ "Cancelled ringing call", cancelled_ringing_call },
{ "Call busy when calling self", call_busy_when_calling_self},
{ "Simple call", simple_call },
{ "Call terminated automatically by linphone_core_destroy", automatic_call_termination },
{ "Call with http proxy", call_with_http_proxy },
{ "Call with timeouted bye", call_with_timeouted_bye },
{ "Direct call over IPv6", direct_call_over_ipv6},
......
......@@ -362,6 +362,7 @@ static void detect_res_prefix(const char* prog) {
#endif
if (prog != NULL) {
if (progpath) free(progpath);
progpath = strdup(prog);
if (strchr(prog, '/') != NULL) {
progpath[strrchr(prog, '/') - prog + 1] = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment