Commit 86a7499f authored by Olivier Crête's avatar Olivier Crête

conncheck: Free password in more obvious way

This should make Coverity's job a little easier. And also fix a little
leak in the error path.
parent 80c43a54
...@@ -2824,6 +2824,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair) ...@@ -2824,6 +2824,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
NiceComponent *component; NiceComponent *component;
gsize uname_len; gsize uname_len;
uint8_t *password = NULL; uint8_t *password = NULL;
uint8_t *free_password = NULL;
gsize password_len; gsize password_len;
bool controlling = agent->controlling_mode; bool controlling = agent->controlling_mode;
/* XXX: add API to support different nomination modes: */ /* XXX: add API to support different nomination modes: */
...@@ -2843,7 +2844,8 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair) ...@@ -2843,7 +2844,8 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
if (password != NULL && if (password != NULL &&
(agent->compatibility == NICE_COMPATIBILITY_MSN || (agent->compatibility == NICE_COMPATIBILITY_MSN ||
agent->compatibility == NICE_COMPATIBILITY_OC2007)) { agent->compatibility == NICE_COMPATIBILITY_OC2007)) {
password = g_base64_decode ((gchar *) password, &password_len); free_password = password =
g_base64_decode ((gchar *) password, &password_len);
} }
if (nice_debug_is_enabled ()) { if (nice_debug_is_enabled ()) {
...@@ -2894,6 +2896,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair) ...@@ -2894,6 +2896,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
if (uname_len == 0) { if (uname_len == 0) {
nice_debug ("Agent %p: no credentials found, cancelling conncheck", agent); nice_debug ("Agent %p: no credentials found, cancelling conncheck", agent);
g_free (free_password);
return -1; return -1;
} }
...@@ -2910,10 +2913,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair) ...@@ -2910,10 +2913,7 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
nice_debug ("Agent %p: conncheck created %zd - %p", agent, buffer_len, nice_debug ("Agent %p: conncheck created %zd - %p", agent, buffer_len,
stun->message.buffer); stun->message.buffer);
if (agent->compatibility == NICE_COMPATIBILITY_MSN || g_free (free_password);
agent->compatibility == NICE_COMPATIBILITY_OC2007) {
g_free (password);
}
if (buffer_len == 0) { if (buffer_len == 0) {
nice_debug ("Agent %p: buffer is empty, cancelling conncheck", agent); nice_debug ("Agent %p: buffer is empty, cancelling conncheck", agent);
......
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