gdp: Fail gracefully if event can't be parsed
authorOlivier Crête <olivier.crete@collabora.com>
Tue, 3 Jun 2014 01:43:56 +0000 (21:43 -0400)
committerOlivier Crête <olivier.crete@collabora.com>
Tue, 3 Jun 2014 01:44:00 +0000 (21:44 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=731093

gst/gdp/dataprotocol.c

index 41fdeb4..420cdff 100644 (file)
@@ -558,6 +558,12 @@ gst_dp_event_from_packet_1_0 (guint header_length, const guint8 * header,
     string =
         g_strndup ((gchar *) payload, GST_DP_HEADER_PAYLOAD_LENGTH (header));
     s = gst_structure_from_string (string, NULL);
+    if (s == NULL) {
+      g_free (string);
+      GST_WARNING ("Could not parse payload string: %s", string);
+      return NULL;
+    }
+
     g_free (string);
   }
   GST_LOG ("Creating event of type 0x%x with structure '%" GST_PTR_FORMAT "'",