Commit b1e12668 authored by Olivier Crête's avatar Olivier Crête

Return deep copy of candidate lists

parent 8d4a4929
...@@ -1551,6 +1551,7 @@ nice_agent_get_local_candidates ( ...@@ -1551,6 +1551,7 @@ nice_agent_get_local_candidates (
{ {
Component *component; Component *component;
GSList * ret = NULL; GSList * ret = NULL;
GSList * item = NULL;
g_mutex_lock (agent->mutex); g_mutex_lock (agent->mutex);
if (!agent_find_component (agent, stream_id, component_id, NULL, &component)) if (!agent_find_component (agent, stream_id, component_id, NULL, &component))
...@@ -1558,7 +1559,8 @@ nice_agent_get_local_candidates ( ...@@ -1558,7 +1559,8 @@ nice_agent_get_local_candidates (
goto done; goto done;
} }
ret = g_slist_copy (component->local_candidates); for (item = component->local_candidates; item; item = item->next)
ret = g_slist_append (ret, nice_candidate_copy (item->data));
done: done:
g_mutex_unlock (agent->mutex); g_mutex_unlock (agent->mutex);
...@@ -1586,7 +1588,7 @@ nice_agent_get_remote_candidates ( ...@@ -1586,7 +1588,7 @@ nice_agent_get_remote_candidates (
guint component_id) guint component_id)
{ {
Component *component; Component *component;
GSList *ret = NULL; GSList *ret = NULL, *item = NULL;
g_mutex_lock (agent->mutex); g_mutex_lock (agent->mutex);
if (!agent_find_component (agent, stream_id, component_id, NULL, &component)) if (!agent_find_component (agent, stream_id, component_id, NULL, &component))
...@@ -1594,7 +1596,8 @@ nice_agent_get_remote_candidates ( ...@@ -1594,7 +1596,8 @@ nice_agent_get_remote_candidates (
goto done; goto done;
} }
ret = g_slist_copy (component->remote_candidates); for (item = component->local_candidates; item; item = item->next)
ret = g_slist_append (ret, nice_candidate_copy (item->data));
done: done:
g_mutex_unlock (agent->mutex); g_mutex_unlock (agent->mutex);
......
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