From 0a1d85c2331d77ddc4fdcf00bb3e5f91e16ced93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 8 Apr 2011 15:10:02 +0200 Subject: [PATCH] rtp: Unref events if the parent element disappeared or has no event handler implemented --- gst-libs/gst/rtp/gstbasertpdepayload.c | 6 +++++- gst-libs/gst/rtp/gstbasertppayload.c | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/rtp/gstbasertpdepayload.c b/gst-libs/gst/rtp/gstbasertpdepayload.c index 94ca7edc96..978a26252e 100644 --- a/gst-libs/gst/rtp/gstbasertpdepayload.c +++ b/gst-libs/gst/rtp/gstbasertpdepayload.c @@ -482,12 +482,16 @@ gst_base_rtp_depayload_handle_sink_event (GstPad * pad, GstEvent * event) GstBaseRTPDepayloadClass *bclass; filter = GST_BASE_RTP_DEPAYLOAD (gst_pad_get_parent (pad)); - if (G_UNLIKELY (filter == NULL)) + if (G_UNLIKELY (filter == NULL)) { + gst_event_unref (event); return FALSE; + } bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter); if (bclass->handle_event) res = bclass->handle_event (filter, event); + else + gst_event_unref (event); gst_object_unref (filter); return res; diff --git a/gst-libs/gst/rtp/gstbasertppayload.c b/gst-libs/gst/rtp/gstbasertppayload.c index a04e308840..060e4e0188 100644 --- a/gst-libs/gst/rtp/gstbasertppayload.c +++ b/gst-libs/gst/rtp/gstbasertppayload.c @@ -383,8 +383,10 @@ gst_basertppayload_event (GstPad * pad, GstEvent * event) gboolean res; basertppayload = GST_BASE_RTP_PAYLOAD (gst_pad_get_parent (pad)); - if (G_UNLIKELY (basertppayload == NULL)) + if (G_UNLIKELY (basertppayload == NULL)) { + gst_event_unref (event); return FALSE; + } basertppayload_class = GST_BASE_RTP_PAYLOAD_GET_CLASS (basertppayload); if (basertppayload_class->handle_event) {