From 028afb264d5ad7cb4ad1befdb49a40b00c47eb1d Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 16 Feb 2016 14:00:59 +0100 Subject: [PATCH] linphonecore.c: release adress after usage --- coreapi/linphonecore.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b07cb11a6..f13d67a48 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3854,22 +3854,21 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){ } int linphone_core_redirect_call(LinphoneCore *lc, LinphoneCall *call, const char *redirect_uri){ - char *real_url=NULL; - LinphoneAddress *real_parsed_url=linphone_core_interpret_url(lc,redirect_uri); - - - if (!real_parsed_url){ - /* bad url */ - ms_error("Bad redirect URI: %s", redirect_uri?:"NULL"); - return -1; - } if (call->state==LinphoneCallIncomingReceived){ + char *real_url=NULL; + LinphoneAddress *real_parsed_url=linphone_core_interpret_url(lc,redirect_uri); + if (!real_parsed_url){ + /* bad url */ + ms_error("Bad redirect URI: %s", redirect_uri?:"NULL"); + return -1; + } real_url=linphone_address_as_string (real_parsed_url); sal_call_decline(call->op,SalReasonRedirect,real_url); ms_free(real_url); sal_error_info_set(&call->non_op_error,SalReasonRedirect,603,"Call redirected",NULL); terminate_call(lc,call); + linphone_address_unref(real_parsed_url); }else{ ms_error("Bad state for call redirection."); return -1;