stream: small fix in error code path
authorXavier Claessens <xavier.claessens@collabora.com>
Thu, 21 Jul 2016 03:18:23 +0000 (23:18 -0400)
committerSebastian Dröge <sebastian@centricular.com>
Mon, 5 Sep 2016 10:24:01 +0000 (13:24 +0300)
https://bugzilla.gnome.org/show_bug.cgi?id=766612

gst/rtsp-server/rtsp-stream.c

index b72a2b2..f3ad1ad 100644 (file)
@@ -1251,10 +1251,14 @@ create_and_configure_udpsources_one_family (GstElement * udpsrc_out[2],
   /* ERRORS */
 error:
   {
-    if (udpsrc_out[0])
-      gst_object_unref (udpsrc_out[0]);
-    if (udpsrc_out[1])
-      gst_object_unref (udpsrc_out[1]);
+    if (udpsrc_out[0]) {
+      gst_element_set_state (udpsrc_out[0], GST_STATE_NULL);
+      g_clear_object (&udpsrc_out[0]);
+    }
+    if (udpsrc_out[1]) {
+      gst_element_set_state (udpsrc_out[1], GST_STATE_NULL);
+      g_clear_object (&udpsrc_out[1]);
+    }
     return FALSE;
   }
 }