Commit a41e12df authored by Youness Alaoui's avatar Youness Alaoui

Make sure we don't free a currently being-refreshed binding

parent 0d130b14
...@@ -656,6 +656,27 @@ priv_binding_expired_timeout (gpointer data) ...@@ -656,6 +656,27 @@ priv_binding_expired_timeout (gpointer data)
ChannelBinding *b = i->data; ChannelBinding *b = i->data;
if (b->timeout_source == g_source_get_id (source)) { if (b->timeout_source == g_source_get_id (source)) {
priv->channels = g_list_remove (priv->channels, b); priv->channels = g_list_remove (priv->channels, b);
/* Make sure we don't free a currently being-refreshed binding */
if (priv->current_binding_msg && !priv->current_binding) {
struct sockaddr sa;
socklen_t sa_len = sizeof(sa);
NiceAddress to;
/* look up binding associated with peer */
stun_message_find_xor_addr (
&priv->current_binding_msg->message,
STUN_ATTRIBUTE_XOR_PEER_ADDRESS, &sa,
&sa_len);
nice_address_set_from_sockaddr (&to, &sa);
/* If the binding is being refreshed, then move it to
priv->current_binding so it counts as a 'new' binding and
will get readded to the list if it succeeds */
if (nice_address_equal (&b->peer, &to)) {
priv->current_binding = b;
break;
}
}
g_free (b); g_free (b);
break; break;
} }
......
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