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

Fix little bugs found by clang-analyzer

parent 928d21e9
...@@ -5849,6 +5849,8 @@ nice_agent_set_software (NiceAgent *agent, const gchar *software) ...@@ -5849,6 +5849,8 @@ nice_agent_set_software (NiceAgent *agent, const gchar *software)
if (software) if (software)
agent->software_attribute = g_strdup_printf ("%s/%s", agent->software_attribute = g_strdup_printf ("%s/%s",
software, PACKAGE_STRING); software, PACKAGE_STRING);
else
agent->software_attribute = NULL;
nice_agent_reset_all_stun_agents (agent, TRUE); nice_agent_reset_all_stun_agents (agent, TRUE);
......
...@@ -3852,7 +3852,7 @@ static bool conncheck_stun_validater (StunAgent *agent, ...@@ -3852,7 +3852,7 @@ static bool conncheck_stun_validater (StunAgent *agent,
ufrag = NULL; ufrag = NULL;
if (cand->username) if (cand->username)
ufrag = cand->username; ufrag = cand->username;
else if (data->stream) else
ufrag = data->stream->local_ufrag; ufrag = data->stream->local_ufrag;
ufrag_len = ufrag? strlen (ufrag) : 0; ufrag_len = ufrag? strlen (ufrag) : 0;
...@@ -3873,7 +3873,7 @@ static bool conncheck_stun_validater (StunAgent *agent, ...@@ -3873,7 +3873,7 @@ static bool conncheck_stun_validater (StunAgent *agent,
if (cand->password) if (cand->password)
pass = cand->password; pass = cand->password;
else if(data->stream->local_password[0]) else if (data->stream && data->stream->local_password[0])
pass = data->stream->local_password; pass = data->stream->local_password;
if (pass) { if (pass) {
......
...@@ -251,7 +251,7 @@ int main (void) ...@@ -251,7 +251,7 @@ int main (void)
if (stun_message_append_xor_addr (&msg, 0xffff, &addr.storage, if (stun_message_append_xor_addr (&msg, 0xffff, &addr.storage,
sizeof (addr)) != STUN_MESSAGE_RETURN_NOT_ENOUGH_SPACE) sizeof (addr)) != STUN_MESSAGE_RETURN_NOT_ENOUGH_SPACE)
fatal ("Address overflow test failed"); fatal ("Address overflow test failed");
len = sizeof (msg);
if (stun_agent_finish_message (&agent, &msg, NULL, 0) != 0) if (stun_agent_finish_message (&agent, &msg, NULL, 0) != 0)
fatal ("Fingerprint overflow test failed"); fatal ("Fingerprint overflow test failed");
if (stun_agent_finish_message (&agent, &msg, pwd, strlen ((char *) pwd)) != 0) if (stun_agent_finish_message (&agent, &msg, pwd, strlen ((char *) pwd)) != 0)
......
...@@ -483,6 +483,8 @@ StunUsageBindReturn stun_usage_bind_run (const struct sockaddr *srv, ...@@ -483,6 +483,8 @@ StunUsageBindReturn stun_usage_bind_run (const struct sockaddr *srv,
socklen_t alternate_server_len = sizeof (alternate_server); socklen_t alternate_server_len = sizeof (alternate_server);
StunUsageBindReturn bind_ret; StunUsageBindReturn bind_ret;
trans.fd = -1;
stun_agent_init (&agent, STUN_ALL_KNOWN_ATTRIBUTES, stun_agent_init (&agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_RFC3489, 0); STUN_COMPATIBILITY_RFC3489, 0);
......
...@@ -105,7 +105,6 @@ create_buffer_list (void) ...@@ -105,7 +105,6 @@ create_buffer_list (void)
GstBufferList *list; GstBufferList *list;
GstBuffer *rtp_buffer; GstBuffer *rtp_buffer;
GstBuffer *data_buffer; GstBuffer *data_buffer;
gint total_size = 0;
list = gst_buffer_list_new (); list = gst_buffer_list_new ();
...@@ -122,8 +121,6 @@ create_buffer_list (void) ...@@ -122,8 +121,6 @@ create_buffer_list (void)
/* Create a new group to hold the rtp header and the payload */ /* Create a new group to hold the rtp header and the payload */
gst_buffer_list_add (list, gst_buffer_append (rtp_buffer, data_buffer)); gst_buffer_list_add (list, gst_buffer_append (rtp_buffer, data_buffer));
total_size += gst_buffer_get_size (rtp_buffer);
/*** Second group, i.e. second packet. ***/ /*** Second group, i.e. second packet. ***/
/* Create the RTP header buffer */ /* Create the RTP header buffer */
...@@ -137,8 +134,6 @@ create_buffer_list (void) ...@@ -137,8 +134,6 @@ create_buffer_list (void)
/* Create a new group to hold the rtp header and the payload */ /* Create a new group to hold the rtp header and the payload */
gst_buffer_list_add (list, gst_buffer_append (rtp_buffer, data_buffer)); gst_buffer_list_add (list, gst_buffer_append (rtp_buffer, data_buffer));
total_size += gst_buffer_get_size (rtp_buffer);
/* Calculate the size of the data */ /* Calculate the size of the data */
data_size = 2 * RTP_HEADER_SIZE + 2 * RTP_PAYLOAD_SIZE; data_size = 2 * RTP_HEADER_SIZE + 2 * RTP_PAYLOAD_SIZE;
......
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