Commit 6337fe84 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix crash in test and memory leak of LinphoneCallParams

parent 17607ab3
......@@ -984,7 +984,7 @@ const char *sal_get_supported_tags(Sal *ctx){
}
void sal_add_supported_tag(Sal *ctx, const char* tag){
MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,NULL);
MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,tag);
if (!elem){
ctx->supported_tags=ms_list_append(ctx->supported_tags,ms_strdup(tag));
make_supported_header(ctx);
......@@ -993,7 +993,7 @@ void sal_add_supported_tag(Sal *ctx, const char* tag){
}
void sal_remove_supported_tag(Sal *ctx, const char* tag){
MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,NULL);
MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,tag);
if (elem){
ms_free(elem->data);
ctx->supported_tags=ms_list_remove_link(ctx->supported_tags,elem);
......
......@@ -3066,3 +3066,10 @@ LinphonePlayer *linphone_call_get_player(LinphoneCall *call){
call->player=linphone_call_build_player(call);
return call->player;
}
void linphone_call_set_new_params(LinphoneCall *call, const LinphoneCallParams *params){
LinphoneCallParams *cp=NULL;
if (params) cp=linphone_call_params_copy(params);
if (call->params) linphone_call_params_unref(call->params);
call->params=cp;
}
......@@ -2820,7 +2820,7 @@ int linphone_core_accept_early_media_with_params(LinphoneCore* lc, LinphoneCall*
// if parameters are passed, update the media description
if ( params ) {
call->params = linphone_call_params_copy(params);
linphone_call_set_new_params(call,params);
linphone_call_make_local_media_description ( lc,call );
sal_call_set_local_media_description ( call->op,call->localdesc );
sal_op_set_sent_custom_header ( call->op,params->custom_headers );
......@@ -2926,8 +2926,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho
}
#endif /* defined(VIDEO_ENABLED) && defined(BUILD_UPNP) */
call->params = linphone_call_params_copy(params);
linphone_call_set_new_params(call,params);
err=linphone_call_prepare_ice(call,FALSE);
if (err==1) {
ms_message("Defer call update to gather ICE candidates");
......@@ -3057,7 +3056,7 @@ int _linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, cons
if (params==NULL){
call->params->has_video=lc->video_policy.automatically_accept || call->current_params->has_video;
}else
call->params = linphone_call_params_copy(params);
linphone_call_set_new_params(call,params);
if (call->params->has_video && !linphone_core_video_enabled(lc)){
ms_warning("linphone_core_accept_call_update(): requested video but video support is globally disabled. Refusing video.");
......@@ -3172,7 +3171,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
linphone_call_set_contact_op(call);
if (params){
const SalMediaDescription *md = sal_call_get_remote_media_description(call->op);
call->params = linphone_call_params_copy(params);
linphone_call_set_new_params(call,params);
// There might not be a md if the INVITE was lacking an SDP
// In this case we use the parameters as is.
if (md) {
......
......@@ -261,6 +261,7 @@ BELLE_SIP_DECLARE_VPTR(LinphoneCall);
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg);
LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op);
void linphone_call_set_new_params(LinphoneCall *call, const LinphoneCallParams *params);
void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const char *message);
void linphone_call_set_contact_op(LinphoneCall* call);
void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, const SalMediaDescription *md);
......
......@@ -2925,6 +2925,7 @@ static void call_with_in_dialog_update(void) {
params=linphone_core_create_call_params(marie->lc,linphone_core_get_current_call(marie->lc));
params->no_user_consent=TRUE;
linphone_core_update_call(marie->lc,linphone_core_get_current_call(marie->lc),params);
linphone_call_params_destroy(params);
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallUpdating,1));
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallUpdatedByRemote,1));
......
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