[Nice] [nice/master] free ufrag and password returned by get_local_credentials
Youness Alaoui
youness.alaoui at collabora.co.uk
Wed Nov 12 17:00:25 PST 2008
---
agent/test-fullmode.c | 34 +++++++++++++++++++++++++++++-----
agent/test-restart.c | 12 ++++++++++--
2 files changed, 39 insertions(+), 7 deletions(-)
diff --git a/agent/test-fullmode.c b/agent/test-fullmode.c
index 400a4ba..3b86c78 100644
--- a/agent/test-fullmode.c
+++ b/agent/test-fullmode.c
@@ -390,13 +390,17 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
/* step: pass the remote candidates to agents */
//cands = g_slist_append (NULL, &cdes);
{
- const gchar *ufrag = NULL, *password = NULL;
+ gchar *ufrag = NULL, *password = NULL;
nice_agent_get_local_credentials(lagent, ls_id, &ufrag, &password);
nice_agent_set_remote_credentials (ragent,
rs_id, ufrag, password);
+ g_free (ufrag);
+ g_free (password);
nice_agent_get_local_credentials(ragent, rs_id, &ufrag, &password);
nice_agent_set_remote_credentials (lagent,
ls_id, ufrag, password);
+ g_free (ufrag);
+ g_free (password);
}
/* cdes.component_id = NICE_COMPONENT_TYPE_RTP;
cdes.addr = raddr;
@@ -544,13 +548,17 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N
/* step: pass the remote candidates to agent R (answering party) */
{
- const gchar *ufrag = NULL, *password = NULL;
+ gchar *ufrag = NULL, *password = NULL;
nice_agent_get_local_credentials(lagent, ls_id, &ufrag, &password);
nice_agent_set_remote_credentials (ragent,
rs_id, ufrag, password);
+ g_free (ufrag);
+ g_free (password);
nice_agent_get_local_credentials(ragent, rs_id, &ufrag, &password);
nice_agent_set_remote_credentials (lagent,
ls_id, ufrag, password);
+ g_free (ufrag);
+ g_free (password);
}
/* step: set remote candidates for agent R (answering party) */
cands = g_slist_append (NULL, &cdes);
@@ -574,13 +582,17 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N
/* step: pass the remote candidates to agent L (offering party) */
{
- const gchar *ufrag = NULL, *password = NULL;
+ gchar *ufrag = NULL, *password = NULL;
nice_agent_get_local_credentials(ragent, rs_id, &ufrag, &password);
nice_agent_set_remote_credentials (lagent,
ls_id, ufrag, password);
+ g_free (ufrag);
+ g_free (password);
nice_agent_get_local_credentials(ragent, rs_id, &ufrag, &password);
nice_agent_set_remote_credentials (lagent,
ls_id, ufrag, password);
+ g_free (ufrag);
+ g_free (password);
}
/* step: pass remove candidates to agent L (offering party) */
@@ -698,19 +710,25 @@ static int run_full_test_wrong_password (NiceAgent *lagent, NiceAgent *ragent, N
raddr = cand->addr;
}
}
+ for (i = cands; i; i = i->next)
+ nice_candidate_free ((NiceCandidate *) i->data);
g_slist_free (cands);
g_debug ("test-fullmode: Got local candidates...");
/* step: pass the remote candidates to agents */
cands = g_slist_append (NULL, &cdes);
{
- const gchar *ufrag = NULL, *password = NULL;
+ gchar *ufrag = NULL, *password = NULL;
nice_agent_get_local_credentials(lagent, ls_id, &ufrag, &password);
nice_agent_set_remote_credentials (ragent,
rs_id, "wrong", password);
+ g_free (ufrag);
+ g_free (password);
nice_agent_get_local_credentials(ragent, rs_id, &ufrag, &password);
nice_agent_set_remote_credentials (lagent,
ls_id, ufrag, "wrong2");
+ g_free (ufrag);
+ g_free (password);
}
cdes.addr = raddr;
nice_agent_set_remote_candidates (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, cands);
@@ -819,19 +837,25 @@ static int run_full_test_control_conflict (NiceAgent *lagent, NiceAgent *ragent,
raddr = cand->addr;
}
}
+ for (i = cands; i; i = i->next)
+ nice_candidate_free ((NiceCandidate *) i->data);
g_slist_free (cands);
g_debug ("test-fullmode: Got local candidates...");
/* step: pass the remote candidates to agents */
cands = g_slist_append (NULL, &cdes);
{
- const gchar *ufrag = NULL, *password = NULL;
+ gchar *ufrag = NULL, *password = NULL;
nice_agent_get_local_credentials(lagent, ls_id, &ufrag, &password);
nice_agent_set_remote_credentials (ragent,
rs_id, ufrag, password);
+ g_free (ufrag);
+ g_free (password);
nice_agent_get_local_credentials(ragent, rs_id, &ufrag, &password);
nice_agent_set_remote_credentials (lagent,
ls_id, ufrag, password);
+ g_free (ufrag);
+ g_free (password);
}
cdes.addr = raddr;
nice_agent_set_remote_candidates (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, cands);
diff --git a/agent/test-restart.c b/agent/test-restart.c
index 9a67481..4886720 100644
--- a/agent/test-restart.c
+++ b/agent/test-restart.c
@@ -276,13 +276,17 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *
/* step: pass the remote candidates to agents */
cands = g_slist_append (NULL, &cdes);
{
- const gchar *ufrag = NULL, *password = NULL;
+ gchar *ufrag = NULL, *password = NULL;
nice_agent_get_local_credentials(lagent, ls_id, &ufrag, &password);
nice_agent_set_remote_credentials (ragent,
rs_id, ufrag, password);
+ g_free (ufrag);
+ g_free (password);
nice_agent_get_local_credentials(ragent, rs_id, &ufrag, &password);
nice_agent_set_remote_credentials (lagent,
ls_id, ufrag, password);
+ g_free (ufrag);
+ g_free (password);
}
cdes.component_id = NICE_COMPONENT_TYPE_RTP;
cdes.addr = raddr;
@@ -328,13 +332,17 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *
g_assert (tie_breaker != ragent->tie_breaker);
nice_agent_restart (lagent);
{
- const gchar *ufrag = NULL, *password = NULL;
+ gchar *ufrag = NULL, *password = NULL;
nice_agent_get_local_credentials(lagent, ls_id, &ufrag, &password);
nice_agent_set_remote_credentials (ragent,
rs_id, ufrag, password);
+ g_free (ufrag);
+ g_free (password);
nice_agent_get_local_credentials(ragent, rs_id, &ufrag, &password);
nice_agent_set_remote_credentials (lagent,
ls_id, ufrag, password);
+ g_free (ufrag);
+ g_free (password);
}
/* send another packet after restart */
--
1.5.6.5
More information about the Nice
mailing list