mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-03 03:39:27 +00:00
Fix memory leaks.
This commit is contained in:
parent
bc59fe4bee
commit
86705803e4
9 changed files with 23 additions and 13 deletions
|
|
@ -2475,13 +2475,15 @@ void linphone_call_init_audio_stream(LinphoneCall *call){
|
|||
|
||||
/* init zrtp even if we didn't explicitely set it, just in case peer offers it */
|
||||
if (ms_zrtp_available()) {
|
||||
char *uri = linphone_address_as_string_uri_only((call->dir==LinphoneCallIncoming) ? call->log->from : call->log->to);
|
||||
MSZrtpParams params;
|
||||
memset(¶ms,0,sizeof(MSZrtpParams));
|
||||
/*call->current_params.media_encryption will be set later when zrtp is activated*/
|
||||
params.zid_file=lc->zrtp_secrets_cache;
|
||||
params.uri= linphone_address_as_string_uri_only((call->dir==LinphoneCallIncoming) ? call->log->from : call->log->to);
|
||||
params.uri=uri;
|
||||
setZrtpCryptoTypesParameters(¶ms,call->core);
|
||||
audio_stream_enable_zrtp(call->audiostream,¶ms);
|
||||
if (uri != NULL) ms_free(uri);
|
||||
}
|
||||
|
||||
media_stream_reclaim_sessions(&audiostream->ms, &call->sessions[call->main_audio_stream_index]);
|
||||
|
|
|
|||
|
|
@ -5159,9 +5159,9 @@ void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy
|
|||
char *stun_server_username = NULL;
|
||||
|
||||
if (lc->nat_policy != NULL) {
|
||||
nat_policy = linphone_nat_policy_ref(lc->nat_policy);
|
||||
stun_server = ms_strdup(linphone_nat_policy_get_stun_server(lc->nat_policy));
|
||||
stun_server_username = ms_strdup(linphone_nat_policy_get_stun_server_username(lc->nat_policy));
|
||||
nat_policy = lc->nat_policy;
|
||||
stun_server = ms_strdup(linphone_nat_policy_get_stun_server(nat_policy));
|
||||
stun_server_username = ms_strdup(linphone_nat_policy_get_stun_server_username(nat_policy));
|
||||
linphone_nat_policy_clear(nat_policy);
|
||||
} else {
|
||||
nat_policy = linphone_core_create_nat_policy(lc);
|
||||
|
|
@ -6374,6 +6374,8 @@ void net_config_uninit(LinphoneCore *lc)
|
|||
if (lc->nat_policy != NULL) {
|
||||
lp_config_set_string(lc->config, "net", "nat_policy_ref", lc->nat_policy->ref);
|
||||
linphone_nat_policy_save_to_config(lc->nat_policy);
|
||||
linphone_nat_policy_unref(lc->nat_policy);
|
||||
lc->nat_policy = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -641,7 +641,7 @@ static void stun_auth_requested_cb(LinphoneCall *call, const char *realm, const
|
|||
const LinphoneAddress *addr = NULL;
|
||||
const LinphoneAuthInfo *auth_info = NULL;
|
||||
LinphoneCore *lc = call->core;
|
||||
const char *user;
|
||||
const char *user = NULL;
|
||||
|
||||
// Get the username from the nat policy or the proxy config
|
||||
if (call->dest_proxy != NULL) proxy = call->dest_proxy;
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ static void _linphone_nat_policy_save_to_config(const LinphoneNatPolicy *policy,
|
|||
}
|
||||
lp_config_set_string_list(config, section, "protocols", l);
|
||||
belle_sip_free(section);
|
||||
ms_list_free(l);
|
||||
}
|
||||
|
||||
void linphone_nat_policy_save_to_config(const LinphoneNatPolicy *policy) {
|
||||
|
|
|
|||
|
|
@ -446,6 +446,7 @@ int linphone_presence_model_add_activity(LinphonePresenceModel *model, LinphoneP
|
|||
return -1;
|
||||
|
||||
presence_model_add_person(model, person);
|
||||
linphone_presence_person_unref(person);
|
||||
} else {
|
||||
/* Add the activity to the first person in the model. */
|
||||
person = (LinphonePresencePerson *)ms_list_nth_data(model->persons, 0);
|
||||
|
|
|
|||
|
|
@ -221,6 +221,9 @@ void _linphone_proxy_config_destroy(LinphoneProxyConfig *cfg){
|
|||
if (cfg->sent_headers!=NULL) sal_custom_header_free(cfg->sent_headers);
|
||||
if (cfg->pending_contact) linphone_address_unref(cfg->pending_contact);
|
||||
if (cfg->refkey) ms_free(cfg->refkey);
|
||||
if (cfg->nat_policy != NULL) {
|
||||
linphone_nat_policy_unref(cfg->nat_policy);
|
||||
}
|
||||
_linphone_proxy_config_release_ops(cfg);
|
||||
}
|
||||
|
||||
|
|
@ -1694,9 +1697,7 @@ LinphoneNatPolicy * linphone_proxy_config_get_nat_policy(const LinphoneProxyConf
|
|||
}
|
||||
|
||||
void linphone_proxy_config_set_nat_policy(LinphoneProxyConfig *cfg, LinphoneNatPolicy *policy) {
|
||||
if (cfg->nat_policy != NULL) {
|
||||
linphone_nat_policy_unref(cfg->nat_policy);
|
||||
cfg->nat_policy = NULL;
|
||||
}
|
||||
if (policy != NULL) cfg->nat_policy = linphone_nat_policy_ref(policy);
|
||||
if (policy != NULL) policy = linphone_nat_policy_ref(policy); /* Prevent object destruction if the same policy is used */
|
||||
if (cfg->nat_policy != NULL) linphone_nat_policy_unref(cfg->nat_policy);
|
||||
if (policy != NULL) cfg->nat_policy = policy;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3997,10 +3997,10 @@ void check_media_direction(LinphoneCoreManager* mgr, LinphoneCall *call, MSList*
|
|||
|
||||
if (video_dir != LinphoneMediaDirectionInactive){
|
||||
BC_ASSERT_TRUE(linphone_call_params_video_enabled(params));
|
||||
BC_ASSERT_EQUAL(linphone_call_params_get_video_direction(params), video_dir, int, "%d");
|
||||
linphone_call_set_next_video_frame_decoded_callback(call,linphone_call_iframe_decoded_cb,mgr->lc);
|
||||
linphone_call_send_vfu_request(call);
|
||||
}
|
||||
BC_ASSERT_EQUAL(linphone_call_params_get_video_direction(params), video_dir, int, "%d");
|
||||
linphone_call_set_next_video_frame_decoded_callback(call,linphone_call_iframe_decoded_cb,mgr->lc);
|
||||
linphone_call_send_vfu_request(call);
|
||||
|
||||
switch (video_dir) {
|
||||
case LinphoneMediaDirectionInactive:
|
||||
|
|
|
|||
|
|
@ -104,6 +104,8 @@ static void configure_nat_policy(LinphoneCore *lc, bool_t turn_enabled) {
|
|||
}
|
||||
linphone_core_set_nat_policy(lc, nat_policy);
|
||||
linphone_core_add_auth_info(lc, auth_info);
|
||||
linphone_nat_policy_unref(nat_policy);
|
||||
linphone_auth_info_destroy(auth_info);
|
||||
}
|
||||
|
||||
static void ice_turn_call_base(bool_t forced_relay, bool_t caller_turn_enabled, bool_t callee_turn_enabled) {
|
||||
|
|
|
|||
|
|
@ -556,6 +556,7 @@ int liblinphone_tester_after_each(void) {
|
|||
ms_error("%s", format);
|
||||
|
||||
all_leaks_buffer = ms_strcat_printf(all_leaks_buffer, "\n%s", format);
|
||||
ms_free(format);
|
||||
}
|
||||
|
||||
// prevent any future leaks
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue