Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
86705803
Commit
86705803
authored
Jun 01, 2016
by
Ghislain MARY
Browse files
Fix memory leaks.
parent
bc59fe4b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
23 additions
and
13 deletions
+23
-13
coreapi/linphonecall.c
coreapi/linphonecall.c
+3
-1
coreapi/linphonecore.c
coreapi/linphonecore.c
+5
-3
coreapi/misc.c
coreapi/misc.c
+1
-1
coreapi/nat_policy.c
coreapi/nat_policy.c
+1
-0
coreapi/presence.c
coreapi/presence.c
+1
-0
coreapi/proxy.c
coreapi/proxy.c
+6
-5
tester/call_tester.c
tester/call_tester.c
+3
-3
tester/stun_tester.c
tester/stun_tester.c
+2
-0
tester/tester.c
tester/tester.c
+1
-0
No files found.
coreapi/linphonecall.c
View file @
86705803
...
...
@@ -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
(
&
params
,
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
(
&
params
,
call
->
core
);
audio_stream_enable_zrtp
(
call
->
audiostream
,
&
params
);
if
(
uri
!=
NULL
)
ms_free
(
uri
);
}
media_stream_reclaim_sessions
(
&
audiostream
->
ms
,
&
call
->
sessions
[
call
->
main_audio_stream_index
]);
...
...
coreapi/linphonecore.c
View file @
86705803
...
...
@@ -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
;
}
}
...
...
coreapi/misc.c
View file @
86705803
...
...
@@ -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
;
...
...
coreapi/nat_policy.c
View file @
86705803
...
...
@@ -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
)
{
...
...
coreapi/presence.c
View file @
86705803
...
...
@@ -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
);
...
...
coreapi/proxy.c
View file @
86705803
...
...
@@ -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
;
}
tester/call_tester.c
View file @
86705803
...
...
@@ -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
:
...
...
tester/stun_tester.c
View file @
86705803
...
...
@@ -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
)
{
...
...
tester/tester.c
View file @
86705803
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment