[0.10] gst-plugins-base: streamsynchronizer: avoid crashing when operating on released pad

Tim Müller tpm at kemper.freedesktop.org
Wed Jan 4 08:01:07 PST 2012


Module: gst-plugins-base
Branch: 0.10
Commit: c89ef946ae5c6a49f7b9997833b580f4277e7fb4
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=c89ef946ae5c6a49f7b9997833b580f4277e7fb4

Author: Mark Nauwelaerts <mark.nauwelaerts at collabora.co.uk>
Date:   Tue Jan  3 11:02:17 2012 +0100

streamsynchronizer: avoid crashing when operating on released pad

---

 gst/playback/gststreamsynchronizer.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/gst/playback/gststreamsynchronizer.c b/gst/playback/gststreamsynchronizer.c
index 45f8db4..3f2b8a8 100644
--- a/gst/playback/gststreamsynchronizer.c
+++ b/gst/playback/gststreamsynchronizer.c
@@ -94,11 +94,16 @@ gst_stream_get_other_pad (GstStream * stream, GstPad * pad)
 static GstPad *
 gst_stream_get_other_pad_from_pad (GstPad * pad)
 {
-  GstStreamSynchronizer *self =
-      GST_STREAM_SYNCHRONIZER (gst_pad_get_parent (pad));
+  GstObject *parent = gst_pad_get_parent (pad);
+  GstStreamSynchronizer *self;
   GstStream *stream;
   GstPad *opad = NULL;
 
+  /* released pad does not have parent anymore */
+  if (!G_LIKELY (parent))
+    goto exit;
+
+  self = GST_STREAM_SYNCHRONIZER (parent);
   GST_STREAM_SYNCHRONIZER_LOCK (self);
   stream = gst_pad_get_element_private (pad);
   if (!stream)
@@ -110,6 +115,7 @@ out:
   GST_STREAM_SYNCHRONIZER_UNLOCK (self);
   gst_object_unref (self);
 
+exit:
   if (!opad)
     GST_WARNING_OBJECT (pad, "Trying to get other pad after releasing");
 



More information about the gstreamer-commits mailing list