if (sessmedia == NULL) {
/* manage the media in our session now, if not done already */
- sessmedia = gst_rtsp_session_manage_media (session, path, media);
+ sessmedia =
+ gst_rtsp_session_manage_media (session, path, g_object_ref (media));
/* if we stil have no media, error */
if (sessmedia == NULL)
goto sessmedia_unavailable;
/* don't cache media anymore */
clean_cached_media (client, FALSE);
- } else {
- g_object_unref (media);
}
ctx->sessmedia = sessmedia;
gst_rtsp_session_media_set_rtsp_state (sessmedia, GST_RTSP_STATE_READY);
break;
}
+ g_object_unref (media);
g_object_unref (session);
g_free (path);
{
GST_ERROR ("client %p: can't create session media", client);
send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
- g_object_unref (media);
- goto cleanup_session;
+ goto cleanup_transport;
}
configure_media_failed_no_reply:
{
GST_ERROR ("client %p: configure_media failed", client);
+ g_object_unref (media);
/* error reply is already sent */
goto cleanup_session;
}
{
cleanup_transport:
gst_rtsp_transport_free (ct);
+ if (media)
+ g_object_unref (media);
cleanup_session:
if (new_session)
gst_rtsp_session_pool_remove (priv->session_pool, session);