ext/: Big shout-out to MikeS for fixing this giant memory leak.

Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(vorbisdec_finalize), (vorbis_handle_type_packet):
Big shout-out to MikeS for fixing this giant memory leak.
Huzzah!
This commit is contained in:
Jan Schmidt 2005-08-26 10:50:56 +00:00
parent 3f478d73e9
commit 538eabd559
4 changed files with 32 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2005-08-26 Jan Schmidt <thaytan@mad.scientist.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(vorbisdec_finalize), (vorbis_handle_type_packet):
Big shout-out to MikeS for fixing this giant memory leak.
Huzzah!
2005-08-25 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_dispose),

2
common

@ -1 +1 @@
Subproject commit aa2a757c587d91069a230d8e656481c3c364ccc6
Subproject commit 7c93670c50de2b6e9d8edd31737c636192fbd831

View file

@ -275,6 +275,9 @@ gst_ogg_pad_dispose (GObject * object)
{
GstOggPad *pad = GST_OGG_PAD (object);
if (pad->element)
gst_element_set_state (pad->element, GST_STATE_NULL);
gst_object_replace ((GstObject **) (&pad->elem_pad), NULL);
gst_object_replace ((GstObject **) (&pad->element), NULL);
gst_object_replace ((GstObject **) (&pad->elem_out), NULL);

View file

@ -72,6 +72,7 @@ GST_STATIC_PAD_TEMPLATE ("sink",
GST_BOILERPLATE (GstVorbisDec, gst_vorbis_dec, GstElement, GST_TYPE_ELEMENT);
static void vorbisdec_finalize (GObject * object);
static gboolean vorbis_dec_sink_event (GstPad * pad, GstEvent * event);
static GstFlowReturn vorbis_dec_chain (GstPad * pad, GstBuffer * buffer);
static GstElementStateReturn vorbis_dec_change_state (GstElement * element);
@ -103,8 +104,11 @@ gst_vorbis_dec_base_init (gpointer g_class)
static void
gst_vorbis_dec_class_init (GstVorbisDecClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
gobject_class->finalize = vorbisdec_finalize;
gstelement_class->change_state = vorbis_dec_change_state;
}
@ -175,6 +179,20 @@ gst_vorbis_dec_init (GstVorbisDec * dec)
dec->queued = NULL;
}
static void
vorbisdec_finalize (GObject * object)
{
/* Release any possibly allocated libvorbis data.
* _clear functions can safely be called multiple times
*/
GstVorbisDec *vd = GST_VORBIS_DEC (object);
vorbis_block_clear (&vd->vb);
vorbis_dsp_clear (&vd->vd);
vorbis_comment_clear (&vd->vc);
vorbis_info_clear (&vd->vi);
}
static gboolean
vorbis_dec_convert (GstPad * pad,
GstFormat src_format, gint64 src_value,
@ -598,6 +616,8 @@ vorbis_handle_comment_packet (GstVorbisDec * vd, ogg_packet * packet)
static GstFlowReturn
vorbis_handle_type_packet (GstVorbisDec * vd)
{
g_assert (vd->initialized == FALSE);
vorbis_synthesis_init (&vd->vd, &vd->vi);
vorbis_block_init (&vd->vd, &vd->vb);
vd->initialized = TRUE;