From 937a42247a22ff50ea1057c09273db93a8497109 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 19 May 2016 11:16:37 +0300 Subject: [PATCH] audioaggregator: fix buffer leak If the pad was still owning a buffer when being destroyed it was leaked. Fix a leak with the test_flush_start_flush_stop test. https://bugzilla.gnome.org/show_bug.cgi?id=766663 --- gst-libs/gst/audio/gstaudioaggregator.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gst-libs/gst/audio/gstaudioaggregator.c b/gst-libs/gst/audio/gstaudioaggregator.c index 5d7e8d634f..a09b8a4446 100644 --- a/gst-libs/gst/audio/gstaudioaggregator.c +++ b/gst-libs/gst/audio/gstaudioaggregator.c @@ -78,13 +78,25 @@ static gboolean gst_audio_aggregator_pad_flush_pad (GstAggregatorPad * aggpad, GstAggregator * aggregator); +static void +gst_audio_aggregator_pad_finalize (GObject * object) +{ + GstAudioAggregatorPad *pad = (GstAudioAggregatorPad *) object; + + gst_buffer_replace (&pad->priv->buffer, NULL); + + G_OBJECT_CLASS (gst_audio_aggregator_pad_parent_class)->finalize (object); +} + static void gst_audio_aggregator_pad_class_init (GstAudioAggregatorPadClass * klass) { + GObjectClass *gobject_class = (GObjectClass *) klass; GstAggregatorPadClass *aggpadclass = (GstAggregatorPadClass *) klass; g_type_class_add_private (klass, sizeof (GstAudioAggregatorPadPrivate)); + gobject_class->finalize = gst_audio_aggregator_pad_finalize; aggpadclass->flush = GST_DEBUG_FUNCPTR (gst_audio_aggregator_pad_flush_pad); }