[0.11] gst-plugins-good: udpsrc: error out when no protocol is specified in the uri

Wim Taymans wtay at kemper.freedesktop.org
Wed Sep 28 03:45:29 PDT 2011


Module: gst-plugins-good
Branch: 0.11
Commit: 3319737e5c1e9b7e9347e3468ed5ecdcb7d3553d
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=3319737e5c1e9b7e9347e3468ed5ecdcb7d3553d

Author: Vincent Penquerc'h <vincent.penquerch at collabora.co.uk>
Date:   Mon Sep  5 10:11:18 2011 +0100

udpsrc: error out when no protocol is specified in the uri

It is certainly better than to crash.

https://bugzilla.gnome.org/show_bug.cgi?id=658178

---

 gst/udp/gstudpnetutils.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/gst/udp/gstudpnetutils.c b/gst/udp/gstudpnetutils.c
index f488fcc..bdbffbc 100644
--- a/gst/udp/gstudpnetutils.c
+++ b/gst/udp/gstudpnetutils.c
@@ -374,7 +374,10 @@ gst_udp_parse_uri (const gchar * uristr, GstUDPUri * uri)
   gchar *location, *location_end;
   gchar *colptr;
 
+  /* consider no protocol to be udp:// */
   protocol = gst_uri_get_protocol (uristr);
+  if (!protocol)
+    goto no_protocol;
   if (strcmp (protocol, "udp") != 0)
     goto wrong_protocol;
   g_free (protocol);
@@ -425,6 +428,11 @@ gst_udp_parse_uri (const gchar * uristr, GstUDPUri * uri)
   return 0;
 
   /* ERRORS */
+no_protocol:
+  {
+    GST_ERROR ("error parsing uri %s: no protocol", uristr);
+    return -1;
+  }
 wrong_protocol:
   {
     GST_ERROR ("error parsing uri %s: wrong protocol (%s != udp)", uristr,



More information about the gstreamer-commits mailing list