From de65529d5219c1f837735136a0bce7ae5925654f Mon Sep 17 00:00:00 2001 From: Fabrice Bellet Date: Wed, 30 Nov 2016 21:17:55 +0100 Subject: [PATCH] basesink: fix a use after free case The event may be disposed while being pushed, so we make sure the debug infrastructure won't use it after the gst_pad_push(). --- libs/gst/base/gstbasesink.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index b4c8752b84..dccf3ce1b8 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -4507,6 +4507,8 @@ gst_base_sink_send_event (GstElement * element, GstEvent * event) } if (forward) { + GST_DEBUG_OBJECT (basesink, "sending event %p %" GST_PTR_FORMAT, event, + event); result = gst_pad_push_event (pad, event); } else { /* not forwarded, unref the event */ @@ -4515,8 +4517,7 @@ gst_base_sink_send_event (GstElement * element, GstEvent * event) gst_object_unref (pad); - GST_DEBUG_OBJECT (basesink, "handled event %p %" GST_PTR_FORMAT ": %d", event, - event, result); + GST_DEBUG_OBJECT (basesink, "handled event: %d", result); return result; }