Commit 02c6238a authored by Youness Alaoui's avatar Youness Alaoui

do not do a strdup for nothing, which may lead to memleaks too

parent 8d20ca91
...@@ -1097,7 +1097,6 @@ static gboolean priv_add_remote_candidate ( ...@@ -1097,7 +1097,6 @@ static gboolean priv_add_remote_candidate (
{ {
Component *component; Component *component;
NiceCandidate *candidate; NiceCandidate *candidate;
gchar *username_dup = NULL, *password_dup = NULL;
gboolean error_flag = FALSE; gboolean error_flag = FALSE;
if (!agent_find_component (agent, stream_id, component_id, NULL, &component)) if (!agent_find_component (agent, stream_id, component_id, NULL, &component))
...@@ -1121,10 +1120,6 @@ static gboolean priv_add_remote_candidate ( ...@@ -1121,10 +1120,6 @@ static gboolean priv_add_remote_candidate (
} }
else { else {
/* case 2: add a new candidate */ /* case 2: add a new candidate */
if (username)
username_dup = g_strdup (username);
if (password)
password_dup = g_strdup (password);
candidate = nice_candidate_new (type); candidate = nice_candidate_new (type);
if (candidate) { if (candidate) {
...@@ -1152,8 +1147,8 @@ static gboolean priv_add_remote_candidate ( ...@@ -1152,8 +1147,8 @@ static gboolean priv_add_remote_candidate (
candidate->transport = transport; candidate->transport = transport;
candidate->priority = priority; candidate->priority = priority;
candidate->username = username_dup; candidate->username = g_strdup (username);
candidate->password = password_dup; candidate->password = g_strdup (password);
if (foundation) if (foundation)
g_strlcpy (candidate->foundation, foundation, NICE_CANDIDATE_MAX_FOUNDATION); g_strlcpy (candidate->foundation, foundation, NICE_CANDIDATE_MAX_FOUNDATION);
...@@ -1171,8 +1166,6 @@ static gboolean priv_add_remote_candidate ( ...@@ -1171,8 +1166,6 @@ static gboolean priv_add_remote_candidate (
if (error_flag) { if (error_flag) {
if (candidate) if (candidate)
nice_candidate_free (candidate); nice_candidate_free (candidate);
g_free (username_dup);
g_free (password_dup);
return FALSE; return FALSE;
} }
......
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