summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2021-03-31 18:07:40 -0300
committerTim-Philipp Müller <tim@centricular.com>2021-09-06 23:25:48 +0100
commit75fbdc91dde3fc499bd8b016c3c12a3484bfecbe (patch)
tree6824578690594c6143cbf34dbfa0ea8b4f52ffaf
parent49224b9c57a45da919abef628d83763cac1a5aef (diff)
downloadgstreamer-plugins-bad-75fbdc91dde3fc499bd8b016c3c12a3484bfecbe.tar.gz
rtpsrc: Fix wrong/NULL URI handling
We can reset the URI to NULL and this fix a deadlock in that case or when the URI was invalid. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2512>
-rw-r--r--gst/rtp/gstrtpsrc.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/gst/rtp/gstrtpsrc.c b/gst/rtp/gstrtpsrc.c
index 69a9caf8d..89ba91c04 100644
--- a/gst/rtp/gstrtpsrc.c
+++ b/gst/rtp/gstrtpsrc.c
@@ -165,16 +165,29 @@ gst_rtp_src_set_property (GObject * object, guint prop_id,
switch (prop_id) {
case PROP_URI:{
GstUri *uri = NULL;
+ const gchar *str_uri = g_value_get_string (value);
GST_RTP_SRC_LOCK (object);
- uri = gst_uri_from_string (g_value_get_string (value));
- if (uri == NULL)
- break;
+ uri = gst_uri_from_string (str_uri);
+ if (uri == NULL) {
+ if (str_uri) {
+ GST_RTP_SRC_UNLOCK (object);
+ GST_ERROR_OBJECT (object, "Invalid uri: %s", str_uri);
+
+ break;
+ }
+ }
if (self->uri)
gst_uri_unref (self->uri);
self->uri = uri;
+ if (!uri) {
+ GST_RTP_SRC_UNLOCK (object);
+
+ break;
+ }
+
/* Recursive set to self, do not use the same lock in all property
* setters. */
g_object_set (self, "address", gst_uri_get_host (self->uri), NULL);