mssdemux: mssmanifest: prevent accessing null stream fragment
authorThiago Santos <thiago.sousa.santos@collabora.com>
Thu, 22 Nov 2012 15:28:20 +0000 (12:28 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Wed, 8 May 2013 00:05:10 +0000 (21:05 -0300)
Move the access to the stream fragment data after the check
if the fragment exists to prevent a segfault

ext/smoothstreaming/gstmssmanifest.c

index 8d92a0ddace0a9bdf115f94b57de9af4c9b357b9..5d6dfa22cfd69437b316d87ef2fd4c71ac5c5eb3 100644 (file)
@@ -346,11 +346,13 @@ gst_mss_stream_get_fragment_url (GstMssStream * stream, gchar ** url)
   gchar *tmp;
   gchar *bitrate_str;
   gchar *start_time_str;
-  GstMssStreamFragment *fragment = stream->current_fragment->data;
+  GstMssStreamFragment *fragment;
 
   if (stream->current_fragment == NULL) /* stream is over */
     return GST_FLOW_UNEXPECTED;
 
+  fragment = stream->current_fragment->data;
+
   bitrate_str =
       (gchar *) xmlGetProp (stream->current_quality->data,
       (xmlChar *) MSS_PROP_BITRATE);