rtsp-client: Remove timeout GSource on cleanup

Avoids ending up with races where a timeout would still be around
*after* a client was gone. This could happen rather easily in
RTSP-over-HTTP mode on a local connection, where each RTSP message
would be sent as a different HTTP connection with the same tunnelid.

If not properly removed, that timeout would then try to free again
a client (and its contents).
This commit is contained in:
Edward Hervey 2018-10-20 16:14:53 +02:00 committed by Edward Hervey
parent 22ced50da5
commit ebafccb65a

View file

@ -782,6 +782,14 @@ gst_rtsp_client_finalize (GObject * obj)
clean_cached_media (client, TRUE);
if (priv->rtsp_ctrl_timeout_id != 0) {
GST_DEBUG ("Killing leftover timeout GSource for client %p", client);
g_source_destroy (g_main_context_find_source_by_id (priv->watch_context,
priv->rtsp_ctrl_timeout_id));
priv->rtsp_ctrl_timeout_id = 0;
priv->rtsp_ctrl_timeout_cnt = 0;
}
g_free (priv->server_ip);
g_mutex_clear (&priv->lock);
g_mutex_clear (&priv->send_lock);