From 4aa734c86ffba207d8f5d0675ce4cfeb2b84fe92 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 9 Jan 2018 18:00:09 +0100 Subject: [PATCH] Memory leak fixes. --- coreapi/linphonecore.c | 2 ++ src/call/call.cpp | 5 +++-- src/conference/session/media-session.cpp | 6 +++--- tester/call_multi_tester.c | 1 + tester/presence_tester.c | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 729538720..c32bf355a 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3550,6 +3550,8 @@ void linphone_configure_op_with_proxy(LinphoneCore *lc, SalOp *op, const Linphon if (contact) salAddress = sal_address_clone(const_cast(L_GET_PRIVATE_FROM_C_OBJECT(contact)->getInternalAddress())); op->set_contact_address(salAddress); + if (salAddress) + sal_address_unref(salAddress); } op->enable_cnx_ip_to_0000_if_sendonly(!!lp_config_get_default_int(lc->config,"sip","cnx_ip_to_0000_if_sendonly_enabled",0)); /*also set in linphone_call_new_incoming*/ } diff --git a/src/call/call.cpp b/src/call/call.cpp index dc9efd3a9..02d79335e 100644 --- a/src/call/call.cpp +++ b/src/call/call.cpp @@ -107,8 +107,9 @@ shared_ptr CallPrivate::startReferredCall (const MediaSessionParams *param lInfo() << "Starting new call to referred address " << q->getReferTo(); L_GET_PRIVATE(&msp)->setReferer(getActiveSession()); L_GET_PRIVATE(getActiveSession())->setReferPending(false); - LinphoneCall *newCall = linphone_core_invite_with_params( - q->getCore()->getCCore(), q->getReferTo().c_str(), L_GET_C_BACK_PTR(&msp)); + LinphoneCallParams *lcp = L_GET_C_BACK_PTR(&msp); + LinphoneCall *newCall = linphone_core_invite_with_params(q->getCore()->getCCore(), q->getReferTo().c_str(), lcp); + linphone_call_params_unref(lcp); if (newCall) { getActiveSession()->getPrivate()->setTransferTarget(L_GET_PRIVATE_FROM_C_OBJECT(newCall)->getActiveSession()); L_GET_PRIVATE_FROM_C_OBJECT(newCall)->getActiveSession()->getPrivate()->notifyReferState(); diff --git a/src/conference/session/media-session.cpp b/src/conference/session/media-session.cpp index b16997868..3913b6a02 100644 --- a/src/conference/session/media-session.cpp +++ b/src/conference/session/media-session.cpp @@ -267,10 +267,10 @@ void MediaSessionPrivate::pauseForTransfer () { void MediaSessionPrivate::pausedByRemote () { L_Q(); - MediaSessionParams *newParams = new MediaSessionParams(*getParams()); + MediaSessionParams newParams(*getParams()); if (lp_config_get_int(linphone_core_get_config(q->getCore()->getCCore()), "sip", "inactive_video_on_pause", 0)) - newParams->setVideoDirection(LinphoneMediaDirectionInactive); - acceptUpdate(newParams, CallSession::State::PausedByRemote, "Call paused by remote"); + newParams.setVideoDirection(LinphoneMediaDirectionInactive); + acceptUpdate(&newParams, CallSession::State::PausedByRemote, "Call paused by remote"); } void MediaSessionPrivate::remoteRinging () { diff --git a/tester/call_multi_tester.c b/tester/call_multi_tester.c index 6ddc56031..aa8f18531 100644 --- a/tester/call_multi_tester.c +++ b/tester/call_multi_tester.c @@ -533,6 +533,7 @@ static void simple_call_transfer(void) { linphone_call_transfer(pauline_called_by_marie,laure_identity); + bctbx_free(laure_identity); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallRefered,1,2000)); /*marie pausing pauline*/ BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallPausing,1,2000)); diff --git a/tester/presence_tester.c b/tester/presence_tester.c index c14ce5b8e..e53db19ed 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -647,7 +647,7 @@ test_t presence_tests[] = { /*TEST_ONE_TAG("Call with presence", call_with_presence, "LeaksMemory"),*/ TEST_NO_TAG("Unsubscribe while subscribing", unsubscribe_while_subscribing), TEST_NO_TAG("Presence information", presence_information), - TEST_ONE_TAG("App managed presence failure", subscribe_failure_handle_by_app, "LeaksMemory"), + TEST_NO_TAG("App managed presence failure", subscribe_failure_handle_by_app), TEST_NO_TAG("Presence SUBSCRIBE forked", subscribe_presence_forked), TEST_NO_TAG("Presence SUBSCRIBE expired", subscribe_presence_expired), };