Commit 14f8578e authored by smorlat's avatar smorlat
Browse files

fix memory leaks

and a big bug !



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@28 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 4ac4e209
......@@ -55,7 +55,7 @@ static void linphone_connect_incoming(LinphoneCore *lc){
int linphone_call_accepted(LinphoneCore *lc, eXosip_event_t *ev)
{
LinphoneCall *call=lc->call;
sdp_message_t *sdp=eXosip_get_sdp_info(ev->response);
sdp_message_t *sdp;
const char *sdpanswer=NULL;
osip_message_t *msg=NULL;
int err;
......@@ -69,6 +69,7 @@ int linphone_call_accepted(LinphoneCore *lc, eXosip_event_t *ev)
return 0; /*already accepted*/
}
linphone_call_init_media_params(call);
sdp=eXosip_get_sdp_info(ev->response);
if (!lc->sip_conf.sdp_200_ack){
err=0;
sdp_context_read_answer(call->sdpctx,sdp);
......@@ -90,6 +91,7 @@ int linphone_call_accepted(LinphoneCore *lc, eXosip_event_t *ev)
ms_error("Incompatible SDP offer received in 200Ok, need to abort the call");
linphone_core_terminate_call(lc,NULL);
}
sdp_message_free(sdp);
return 0;
}
......@@ -247,7 +249,7 @@ static int linphone_answer_sdp(LinphoneCore *lc, eXosip_event_t *ev, sdp_message
int linphone_inc_new_call(LinphoneCore *lc, eXosip_event_t *ev)
{
sdp_message_t *sdp=eXosip_get_sdp_info(ev->request);
sdp_message_t *sdp=NULL;
osip_from_t *from_url=ev->request->from;
char *barmesg;
char *from;
......@@ -297,6 +299,7 @@ int linphone_inc_new_call(LinphoneCore *lc, eXosip_event_t *ev)
goto end;
}
lc->call=linphone_call_new_incoming(lc,from,to,ev->cid,ev->did,ev->tid);
sdp=eXosip_get_sdp_info(ev->request);
if (sdp==NULL){
ms_message("No sdp body in invite, 200-ack scheme");
err=0;
......@@ -336,6 +339,7 @@ int linphone_inc_new_call(LinphoneCore *lc, eXosip_event_t *ev)
end:
osip_free(from);
osip_free(to);
if (sdp) sdp_message_free(sdp);
return 0;
}
......@@ -344,6 +348,7 @@ void linphone_handle_ack(LinphoneCore *lc, eXosip_event_t *ev){
if (sdp){
sdp_context_read_answer(lc->call->sdpctx,sdp);
linphone_connect_incoming(lc);
sdp_message_free(sdp);
}
}
......@@ -374,6 +379,7 @@ void linphone_handle_reinvite(LinphoneCore *lc, eXosip_event_t *ev){
ms_warning("Reinvite for closed call ?");
eXosip_unlock();
linphone_core_stop_media_streams(lc);
sdp_message_free(sdp);
return ;
}
answer=call->sdpctx->answerstr; /* takes the sdp already computed*/
......@@ -386,6 +392,7 @@ void linphone_handle_reinvite(LinphoneCore *lc, eXosip_event_t *ev){
eXosip_call_send_answer(ev->tid,status,NULL);
eXosip_unlock();
}
sdp_message_free(sdp);
}
void linphone_do_automatic_redirect(LinphoneCore *lc, const char *contact){
......
......@@ -75,7 +75,6 @@ int lc_callback_obj_invoke(LCCallbackObj *obj, LinphoneCore *lc){
}
static void linphone_call_init_common(LinphoneCall *call, char *from, char *to){
sdp_context_set_user_pointer(call->sdpctx,(void*)call);
call->state=LCStateInit;
call->start_time=time(NULL);
call->log=linphone_call_log_new(call, from, to);
......@@ -119,6 +118,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, const osip_f
call->sdpctx=sdp_handler_create_context(&linphone_sdphandler,
call->audio_params.natd_port>0 ? call->audio_params.natd_addr : localip,
from->url->username,NULL);
sdp_context_set_user_pointer(call->sdpctx,(void*)call);
discover_mtu(lc,to->url->host);
return call;
}
......@@ -142,6 +142,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, const char *from, co
call->sdpctx=sdp_handler_create_context(&linphone_sdphandler,
call->audio_params.natd_port>0 ? call->audio_params.natd_addr : localip,
me->url->username,NULL);
sdp_context_set_user_pointer(call->sdpctx,(void*)call);
discover_mtu(lc,from_url->url->host);
osip_from_free(me);
osip_from_free(from_url);
......@@ -2142,6 +2143,7 @@ void sound_config_uninit(LinphoneCore *lc)
lp_config_set_string(lc->config,"sound","local_ring",config->local_ring);
lp_config_set_string(lc->config,"sound","remote_ring",config->remote_ring);
lp_config_set_int(lc->config,"sound","echocancelation",config->ec);
if (config->local_ring) ms_free(config->local_ring);
}
void video_config_uninit(LinphoneCore *lc)
......
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