rtspclientsink: make sure not to use freed string

Set transport string to NULL after freeing it, so that
at worst we get a NULL pointer if constructing a new
transport string fails (which shouldn't really fail here).
Also check return value of that, just in case.

CID 1433768.
This commit is contained in:
Tim-Philipp Müller 2018-04-02 12:35:04 +01:00
parent c36d6b477c
commit e3bbd40f0e

View file

@ -3966,9 +3966,13 @@ gst_rtsp_client_sink_setup_streams (GstRTSPClientSink * sink, gboolean async)
* the request headers instead of the previous, incomplete one.
*/
g_free (transports);
transports = NULL;
res = gst_rtsp_client_sink_create_transports_string (sink, context, family,
protocols & protocol_masks[mask], cur_profile, &transports);
if (res < 0 || transports == NULL)
goto setup_transport_failed;
/* select transport */
gst_rtsp_message_take_header (&request, GST_RTSP_HDR_TRANSPORT, transports);