From fd285ca7b762814bcf3c29f6ccb1450f083cd58d Mon Sep 17 00:00:00 2001 From: smorlat Date: Mon, 7 Sep 2009 19:14:28 +0000 Subject: [PATCH] fix 2 crashes, one when rport is null , other when using no proxy at all. git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@640 3f6dc0c8-ddfe-455d-9043-3cd528dc4637 --- linphone/coreapi/linphonecore.c | 8 ++++---- linphone/coreapi/proxy.c | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/linphone/coreapi/linphonecore.c b/linphone/coreapi/linphonecore.c index 382566a21..760bc0c14 100644 --- a/linphone/coreapi/linphonecore.c +++ b/linphone/coreapi/linphonecore.c @@ -1275,7 +1275,7 @@ LinphoneProxyConfig * linphone_core_lookup_known_proxy(LinphoneCore *lc, const c return found_cfg; } -static void fix_contact(osip_message_t *msg, const char *localip, LinphoneProxyConfig *dest_proxy){ +static void fix_contact(LinphoneCore *lc, osip_message_t *msg, const char *localip, LinphoneProxyConfig *dest_proxy){ osip_contact_t *ctt=NULL; const char *ip=NULL; int port=5060; @@ -1288,7 +1288,7 @@ static void fix_contact(osip_message_t *msg, const char *localip, LinphoneProxyC linphone_proxy_config_get_contact(dest_proxy,&ip,&port); }else{ ip=localip; - port=linphone_core_get_sip_port(dest_proxy->lc); + port=linphone_core_get_sip_port(lc); } if (ip!=NULL){ osip_free(ctt->url->host); @@ -1366,7 +1366,7 @@ int linphone_core_invite(LinphoneCore *lc, const char *url) /*try to be best-effort in giving real local or routable contact address, except when the user choosed to override the ipaddress */ if (linphone_core_get_firewall_policy(lc)!=LINPHONE_POLICY_USE_NAT_ADDRESS) - fix_contact(invite,lc->call->localip,dest_proxy); + fix_contact(lc,invite,lc->call->localip,dest_proxy); barmsg=ortp_strdup_printf("%s %s", _("Contacting"), real_url); lc->vtable.display_status(lc,barmsg); @@ -1748,7 +1748,7 @@ int linphone_core_accept_call(LinphoneCore *lc, const char *url) /*try to be best-effort in giving real local or routable contact address, except when the user choosed to override the ipaddress */ if (linphone_core_get_firewall_policy(lc)!=LINPHONE_POLICY_USE_NAT_ADDRESS) - fix_contact(msg,call->localip,NULL); + fix_contact(lc,msg,call->localip,NULL); /*if a sdp answer is computed, send it, else send an offer */ sdpmesg=call->sdpctx->answerstr; if (sdpmesg==NULL){ diff --git a/linphone/coreapi/proxy.c b/linphone/coreapi/proxy.c index 1fc307d09..c5fccf4bd 100644 --- a/linphone/coreapi/proxy.c +++ b/linphone/coreapi/proxy.c @@ -76,8 +76,9 @@ static void update_contact(LinphoneProxyConfig *cfg, const char *ip, const char ms_free(cfg->contact_addr); } cfg->contact_addr=ms_strdup(ip); - cfg->contact_port=atoi(port); - if (cfg->contact_port==0) cfg->contact_port=5060; + if (port!=NULL) + cfg->contact_port=atoi(port); + else cfg->contact_port=5060; } bool_t linphone_proxy_config_register_again_with_updated_contact(LinphoneProxyConfig *obj, osip_message_t *orig_request, osip_message_t *last_answer){