From 9ecad5ee018999504e670d12fa44045ca7722846 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 7 May 2004 20:26:47 +0000 Subject: [PATCH] fix a number of memleaks Original commit message from CVS: fix a number of memleaks --- ChangeLog | 8 ++++++++ gst/audioscale/gstaudioscale.c | 14 ++++++++++++++ gst/volume/gstvolume.c | 4 ++++ 3 files changed, 26 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8b7fd9edfa..f12e90d5c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-05-07 Colin Walters + + * gst/volume/gstvolume.c (gst_volume_dispose): Unref dpman. + * ext/flac/gstflacdec.c (gst_flacdec_dispose): Add dispose + function. + * gst/audioscale/gstaudioscale.c (gst_audioscale_dispose): + Add dispose function. + 2004-05-08 Jan Schmidt * ext/dv/gstdvdec.c: (gst_dvdec_video_link): Fix caps nego and pad templates. RGB mode caps should diff --git a/gst/audioscale/gstaudioscale.c b/gst/audioscale/gstaudioscale.c index 49a37420c1..ee2fa3f8bf 100644 --- a/gst/audioscale/gstaudioscale.c +++ b/gst/audioscale/gstaudioscale.c @@ -88,6 +88,7 @@ gst_audioscale_method_get_type (void) static void gst_audioscale_base_init (gpointer g_class); static void gst_audioscale_class_init (AudioscaleClass * klass); static void gst_audioscale_init (Audioscale * audioscale); +static void gst_audioscale_dispose (GObject * object); static void gst_audioscale_chain (GstPad * pad, GstData * _data); @@ -149,6 +150,7 @@ gst_audioscale_class_init (AudioscaleClass * klass) gobject_class->set_property = gst_audioscale_set_property; gobject_class->get_property = gst_audioscale_get_property; + gobject_class->dispose = gst_audioscale_dispose; g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FILTERLEN, g_param_spec_int ("filter_length", "filter_length", "filter_length", @@ -383,6 +385,18 @@ gst_audioscale_init (Audioscale * audioscale) /* we will be reinitialized when the G_PARAM_CONSTRUCTs hit */ } +static void +gst_audioscale_dispose (GObject * object) +{ + Audioscale *audioscale = GST_AUDIOSCALE (object); + + if (audioscale->gst_resample) + g_free (audioscale->gst_resample); + audioscale->gst_resample = NULL; + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + static void gst_audioscale_chain (GstPad * pad, GstData * _data) { diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c index 83c230b7c7..e177ab891c 100644 --- a/gst/volume/gstvolume.c +++ b/gst/volume/gstvolume.c @@ -219,6 +219,10 @@ gst_volume_dispose (GObject * object) volume = GST_VOLUME (object); + if (volume->dpman) + g_object_unref (G_OBJECT (volume->dpman)); + volume->dpman = NULL; + if (volume->tracklist) { if (volume->tracklist->data) g_object_unref (volume->tracklist->data);