client: cleanup error paths

This commit is contained in:
Wim Taymans 2014-04-03 12:57:13 +02:00
parent 07ae06a595
commit f8a6a5668d

View file

@ -1577,86 +1577,78 @@ no_transport:
{ {
GST_ERROR ("client %p: no transport", client); GST_ERROR ("client %p: no transport", client);
send_generic_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT, ctx); send_generic_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT, ctx);
g_free (path); goto cleanup_path;
return FALSE;
} }
no_pool: no_pool:
{ {
GST_ERROR ("client %p: no session pool configured", client); GST_ERROR ("client %p: no session pool configured", client);
send_generic_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx); send_generic_response (client, GST_RTSP_STS_SESSION_NOT_FOUND, ctx);
g_free (path); goto cleanup_path;
return FALSE;
} }
media_not_found_no_reply: media_not_found_no_reply:
{ {
GST_ERROR ("client %p: media '%s' not found", client, path); GST_ERROR ("client %p: media '%s' not found", client, path);
g_free (path);
/* error reply is already sent */ /* error reply is already sent */
return FALSE; goto cleanup_path;
} }
media_not_found: media_not_found:
{ {
GST_ERROR ("client %p: media '%s' not found", client, path); GST_ERROR ("client %p: media '%s' not found", client, path);
send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx); send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
g_free (path); goto cleanup_path;
return FALSE;
} }
control_not_found: control_not_found:
{ {
GST_ERROR ("client %p: no control in path '%s'", client, path); GST_ERROR ("client %p: no control in path '%s'", client, path);
send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx); send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
g_object_unref (media); g_object_unref (media);
g_free (path); goto cleanup_path;
return FALSE;
} }
stream_not_found: stream_not_found:
{ {
GST_ERROR ("client %p: stream '%s' not found", client, control); GST_ERROR ("client %p: stream '%s' not found", client, control);
send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx); send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
g_object_unref (media); g_object_unref (media);
g_free (path); goto cleanup_path;
return FALSE;
} }
service_unavailable: service_unavailable:
{ {
GST_ERROR ("client %p: can't create session", client); GST_ERROR ("client %p: can't create session", client);
send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx); send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
g_object_unref (media); g_object_unref (media);
g_free (path); goto cleanup_path;
return FALSE;
} }
sessmedia_unavailable: sessmedia_unavailable:
{ {
GST_ERROR ("client %p: can't create session media", client); GST_ERROR ("client %p: can't create session media", client);
send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx); send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
g_object_unref (media); g_object_unref (media);
g_object_unref (session); goto cleanup_session;
g_free (path);
return FALSE;
} }
configure_media_failed_no_reply: configure_media_failed_no_reply:
{ {
GST_ERROR ("client %p: configure_media failed", client); GST_ERROR ("client %p: configure_media failed", client);
g_object_unref (session);
g_free (path);
/* error reply is already sent */ /* error reply is already sent */
return FALSE; goto cleanup_session;
} }
unsupported_transports: unsupported_transports:
{ {
GST_ERROR ("client %p: unsupported transports", client); GST_ERROR ("client %p: unsupported transports", client);
send_generic_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT, ctx); send_generic_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT, ctx);
gst_rtsp_transport_free (ct); goto cleanup_transport;
g_object_unref (session);
g_free (path);
return FALSE;
} }
unsupported_client_transport: unsupported_client_transport:
{ {
GST_ERROR ("client %p: unsupported client transport", client); GST_ERROR ("client %p: unsupported client transport", client);
send_generic_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT, ctx); send_generic_response (client, GST_RTSP_STS_UNSUPPORTED_TRANSPORT, ctx);
goto cleanup_transport;
}
{
cleanup_transport:
gst_rtsp_transport_free (ct); gst_rtsp_transport_free (ct);
cleanup_session:
g_object_unref (session); g_object_unref (session);
cleanup_path:
g_free (path); g_free (path);
return FALSE; return FALSE;
} }