Commit b7fe837d authored by Youness Alaoui's avatar Youness Alaoui

oups, correctly free the tcp clock/data when the component is freed, not only...

oups, correctly free the tcp clock/data when the component is freed, not only when the stream is manually removed through the API
parent 65c14a4c
......@@ -942,8 +942,8 @@ static void priv_pseudo_tcp_error (NiceAgent *agent, Stream *stream,
agent_signal_component_state_change (agent, stream->id,
component->id, NICE_COMPONENT_STATE_FAILED);
priv_detach_stream_component (stream, component);
priv_destroy_component_tcp (component);
}
priv_destroy_component_tcp (component);
}
static void
......@@ -1883,7 +1883,6 @@ nice_agent_remove_stream (
/* note that streams/candidates can be in use by other threads */
Stream *stream;
GSList *i;
agent_lock();
stream = agent_find_stream (agent, stream_id);
......@@ -1898,12 +1897,6 @@ nice_agent_remove_stream (
refresh_prune_stream (agent, stream_id);
/* remove the stream itself */
for (i = stream->components; i; i = i->next) {
Component *component = (Component *) i->data;
priv_detach_stream_component (stream, component);
priv_destroy_component_tcp (component);
}
agent->streams = g_slist_remove (agent->streams, stream);
stream_free (stream);
......
......@@ -125,6 +125,21 @@ component_free (Component *cmp)
cmp->selected_pair.keepalive.tick_source = NULL;
}
if (cmp->tcp_clock) {
g_source_destroy (cmp->tcp_clock);
g_source_unref (cmp->tcp_clock);
cmp->tcp_clock = NULL;
}
if (cmp->tcp) {
pseudo_tcp_socket_close (cmp->tcp, TRUE);
g_object_unref (cmp->tcp);
cmp->tcp = NULL;
}
if (cmp->tcp_data != NULL) {
g_slice_free (TcpUserData, cmp->tcp_data);
cmp->tcp_data = NULL;
}
g_slice_free (Component, cmp);
}
......
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