From 7c9d810eeb8ddb024be426c00e10c71f13329f43 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 8 Jan 2018 17:07:04 +0100 Subject: [PATCH] Some more memory leaks fixes. --- src/conference/session/media-session.cpp | 1 + tester/tester.c | 36 ++++++++++++++++-------- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/conference/session/media-session.cpp b/src/conference/session/media-session.cpp index 539a85ae0..3f2f680e2 100644 --- a/src/conference/session/media-session.cpp +++ b/src/conference/session/media-session.cpp @@ -4038,6 +4038,7 @@ void MediaSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cf /* Create the ice session now if ICE is required */ d->iceAgent->checkSession(IR_Controlled, false); } else { + linphone_nat_policy_unref(d->natPolicy); d->natPolicy = nullptr; lWarning() << "ICE not supported for incoming INVITE without SDP"; } diff --git a/tester/tester.c b/tester/tester.c index 003d4d3a1..04e0456bb 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -804,10 +804,12 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph if (video_enabled){ liblinphone_tester_clock_start(&ts); - do{ + LinphoneCallStats *stats1 = NULL; + LinphoneCallStats *stats2 = NULL; + do { if ((c1 != NULL) && (c2 != NULL)) { - LinphoneCallStats *stats1 = linphone_call_get_video_stats(c1); - LinphoneCallStats *stats2 = linphone_call_get_video_stats(c2); + stats1 = linphone_call_get_video_stats(c1); + stats2 = linphone_call_get_video_stats(c2); if (linphone_call_stats_get_ice_state(stats1)==state && linphone_call_stats_get_ice_state(stats2)==state){ video_success=TRUE; @@ -815,21 +817,27 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph check_ice_from_rtp(c2,c1,LinphoneStreamTypeVideo); break; } - linphone_call_stats_unref(stats1); - linphone_call_stats_unref(stats2); linphone_core_iterate(caller->lc); linphone_core_iterate(callee->lc); + linphone_call_stats_unref(stats1); + linphone_call_stats_unref(stats2); } ms_usleep(20000); - }while(!liblinphone_tester_clock_elapsed(&ts,10000)); + } while (!liblinphone_tester_clock_elapsed(&ts,10000)); + if (stats1) + linphone_call_stats_unref(stats1); + if (stats2) + linphone_call_stats_unref(stats2); } if (realtime_text_enabled){ liblinphone_tester_clock_start(&ts); - do{ + LinphoneCallStats *stats1 = NULL; + LinphoneCallStats *stats2 = NULL; + do { if ((c1 != NULL) && (c2 != NULL)) { - LinphoneCallStats *stats1 = linphone_call_get_text_stats(c1); - LinphoneCallStats *stats2 = linphone_call_get_text_stats(c2); + stats1 = linphone_call_get_text_stats(c1); + stats2 = linphone_call_get_text_stats(c2); if (linphone_call_stats_get_ice_state(stats1)==state && linphone_call_stats_get_ice_state(stats2)==state){ text_success=TRUE; @@ -837,13 +845,17 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph check_ice_from_rtp(c2,c1,LinphoneStreamTypeText); break; } - linphone_call_stats_unref(stats1); - linphone_call_stats_unref(stats2); linphone_core_iterate(caller->lc); linphone_core_iterate(callee->lc); + linphone_call_stats_unref(stats1); + linphone_call_stats_unref(stats2); } ms_usleep(20000); - }while(!liblinphone_tester_clock_elapsed(&ts,10000)); + } while (!liblinphone_tester_clock_elapsed(&ts,10000)); + if (stats1) + linphone_call_stats_unref(stats1); + if (stats2) + linphone_call_stats_unref(stats2); } /*make sure encryption mode are preserved*/