Fix a bunch of leaks shown by the newly-added states test.
authorJan Schmidt <thaytan@mad.scientist.com>
Sun, 4 Mar 2007 13:52:03 +0000 (13:52 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Sun, 4 Mar 2007 13:52:03 +0000 (13:52 +0000)
Original commit message from CVS:
* ext/flac/gstflacenc.c: (gst_flac_enc_finalize):
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_class_init),
(gst_gconf_audio_sink_dispose), (gst_gconf_audio_sink_finalize):
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init),
(gst_gconf_audio_src_class_init), (gst_gconf_audio_src_dispose),
(gst_gconf_audio_src_finalize), (do_toggle_element):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init),
(gst_gconf_video_sink_class_init), (gst_gconf_video_sink_finalize),
(do_toggle_element):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init),
(gst_gconf_video_src_class_init), (gst_gconf_video_src_dispose),
(gst_gconf_video_src_finalize), (do_toggle_element):
* ext/gconf/gstswitchsink.c: (gst_switch_sink_class_init),
(gst_switch_sink_reset), (gst_switch_sink_set_child):
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
* ext/shout2/gstshout2.c: (gst_shout2send_class_init),
(gst_shout2send_init), (gst_shout2send_finalize):
* gst/debug/testplugin.c: (gst_test_class_init),
(gst_test_finalize):
* gst/flx/gstflxdec.c: (gst_flxdec_class_init),
(gst_flxdec_dispose):
* gst/multipart/multipartmux.c: (gst_multipart_mux_finalize):
* gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize):
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init),
(gst_rtspsrc_finalize):
* gst/rtsp/rtspextwms.c: (rtsp_ext_wms_free_context):
* gst/rtsp/rtspextwms.h:
* gst/smpte/gstsmpte.c: (gst_smpte_class_init),
(gst_smpte_finalize):
* gst/udp/gstmultiudpsink.c: (gst_multiudpsink_finalize):
* gst/udp/gstudpsink.c: (gst_udpsink_class_init),
(gst_udpsink_finalize):
* gst/wavparse/gstwavparse.c: (gst_wavparse_dispose),
(gst_wavparse_sink_activate):
* sys/oss/gstosssink.c: (gst_oss_sink_finalise):
* sys/oss/gstosssrc.c: (gst_oss_src_class_init),
(gst_oss_src_finalize):
* sys/v4l2/gstv4l2object.c: (gst_v4l2_object_destroy):
* sys/v4l2/gstv4l2object.h:
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
(gst_v4l2src_finalize):
* sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get):
Fix a bunch of leaks shown by the newly-added states test.

27 files changed:
ChangeLog
ext/flac/gstflacenc.c
ext/gconf/gstgconfaudiosink.c
ext/gconf/gstgconfaudiosrc.c
ext/gconf/gstgconfvideosink.c
ext/gconf/gstgconfvideosrc.c
ext/gconf/gstswitchsink.c
ext/hal/gsthalaudiosink.c
ext/hal/gsthalaudiosrc.c
ext/shout2/gstshout2.c
gst/debug/testplugin.c
gst/flx/gstflxdec.c
gst/multipart/multipartmux.c
gst/rtp/gstrtpmp4gpay.c
gst/rtsp/gstrtspsrc.c
gst/rtsp/rtspextwms.c
gst/rtsp/rtspextwms.h
gst/smpte/gstsmpte.c
gst/udp/gstmultiudpsink.c
gst/udp/gstudpsink.c
gst/wavparse/gstwavparse.c
sys/oss/gstosssink.c
sys/oss/gstosssrc.c
sys/v4l2/gstv4l2object.c
sys/v4l2/gstv4l2object.h
sys/v4l2/gstv4l2src.c
sys/ximage/gstximagesrc.c

index e019360..19b11ab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,53 @@
 2007-03-04  Jan Schmidt  <thaytan@mad.scientist.com>
 
+       * ext/flac/gstflacenc.c: (gst_flac_enc_finalize):
+       * ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_class_init),
+       (gst_gconf_audio_sink_dispose), (gst_gconf_audio_sink_finalize):
+       * ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init),
+       (gst_gconf_audio_src_class_init), (gst_gconf_audio_src_dispose),
+       (gst_gconf_audio_src_finalize), (do_toggle_element):
+       * ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init),
+       (gst_gconf_video_sink_class_init), (gst_gconf_video_sink_finalize),
+       (do_toggle_element):
+       * ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init),
+       (gst_gconf_video_src_class_init), (gst_gconf_video_src_dispose),
+       (gst_gconf_video_src_finalize), (do_toggle_element):
+       * ext/gconf/gstswitchsink.c: (gst_switch_sink_class_init),
+       (gst_switch_sink_reset), (gst_switch_sink_set_child):
+       * ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
+       * ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
+       * ext/shout2/gstshout2.c: (gst_shout2send_class_init),
+       (gst_shout2send_init), (gst_shout2send_finalize):
+       * gst/debug/testplugin.c: (gst_test_class_init),
+       (gst_test_finalize):
+       * gst/flx/gstflxdec.c: (gst_flxdec_class_init),
+       (gst_flxdec_dispose):
+       * gst/multipart/multipartmux.c: (gst_multipart_mux_finalize):
+       * gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize):
+       * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init),
+       (gst_rtspsrc_finalize):
+       * gst/rtsp/rtspextwms.c: (rtsp_ext_wms_free_context):
+       * gst/rtsp/rtspextwms.h:
+       * gst/smpte/gstsmpte.c: (gst_smpte_class_init),
+       (gst_smpte_finalize):
+       * gst/udp/gstmultiudpsink.c: (gst_multiudpsink_finalize):
+       * gst/udp/gstudpsink.c: (gst_udpsink_class_init),
+       (gst_udpsink_finalize):
+       * gst/wavparse/gstwavparse.c: (gst_wavparse_dispose),
+       (gst_wavparse_sink_activate):
+       * sys/oss/gstosssink.c: (gst_oss_sink_finalise):
+       * sys/oss/gstosssrc.c: (gst_oss_src_class_init),
+       (gst_oss_src_finalize):
+       * sys/v4l2/gstv4l2object.c: (gst_v4l2_object_destroy):
+       * sys/v4l2/gstv4l2object.h:
+       * sys/v4l2/gstv4l2src.c: (gst_v4l2src_class_init),
+       (gst_v4l2src_finalize):
+       * sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get):
+
+       Fix a bunch of leaks shown by the newly-added states test.
+
+2007-03-04  Jan Schmidt  <thaytan@mad.scientist.com>
+
        * ext/dv/gstdvdec.c: (gst_dvdec_init):
        Use gst_pad_new_from_static_template instead of 
        static_pad_template_get+pad_new.
index 90888fb..b257681 100644 (file)
@@ -315,6 +315,7 @@ gst_flac_enc_finalize (GObject * object)
 {
   GstFlacEnc *flacenc = GST_FLAC_ENC (object);
 
+  gst_tag_list_free (flacenc->tags);
   FLAC__seekable_stream_encoder_delete (flacenc->encoder);
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
index 3ac1b89..0737af6 100644 (file)
@@ -28,6 +28,7 @@
 #include "gstgconfaudiosink.h"
 
 static void gst_gconf_audio_sink_dispose (GObject * object);
+static void gst_gconf_audio_sink_finalize (GstGConfAudioSink * sink);
 static void cb_change_child (GConfClient * client,
     guint connection_id, GConfEntry * entry, gpointer data);
 static GstStateChangeReturn
@@ -91,6 +92,7 @@ gst_gconf_audio_sink_class_init (GstGConfAudioSinkClass * klass)
   oklass->set_property = gst_gconf_audio_sink_set_property;
   oklass->get_property = gst_gconf_audio_sink_get_property;
   oklass->dispose = gst_gconf_audio_sink_dispose;
+  oklass->finalize = (GObjectFinalizeFunc) gst_gconf_audio_sink_finalize;
   eklass->change_state = gst_gconf_audio_sink_change_state;
 
   g_object_class_install_property (oklass, PROP_PROFILE,
@@ -131,10 +133,15 @@ gst_gconf_audio_sink_dispose (GObject * object)
     sink->client = NULL;
   }
 
+  GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+}
+
+static void
+gst_gconf_audio_sink_finalize (GstGConfAudioSink * sink)
+{
   g_free (sink->gconf_str);
-  sink->gconf_str = NULL;
 
-  GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+  GST_CALL_PARENT (G_OBJECT_CLASS, finalize, ((GObject *) (sink)));
 }
 
 static gboolean
index 0203c2e..b9379c4 100644 (file)
@@ -28,6 +28,7 @@
 #include "gstgconfaudiosrc.h"
 
 static void gst_gconf_audio_src_dispose (GObject * object);
+static void gst_gconf_audio_src_finalize (GstGConfAudioSrc * src);
 static void cb_toggle_element (GConfClient * client,
     guint connection_id, GConfEntry * entry, gpointer data);
 static GstStateChangeReturn
@@ -45,7 +46,7 @@ gst_gconf_audio_src_base_init (gpointer klass)
       "Source/Audio",
       "Audio source embedding the GConf-settings for audio input",
       "Ronald Bultje <rbultje@ronald.bitfreak.net>");
-  GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+  static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
       GST_PAD_SRC,
       GST_PAD_ALWAYS,
       GST_STATIC_CAPS_ANY);
@@ -62,6 +63,7 @@ gst_gconf_audio_src_class_init (GstGConfAudioSrcClass * klass)
   GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
 
   oklass->dispose = gst_gconf_audio_src_dispose;
+  oklass->finalize = (GObjectFinalizeFunc) gst_gconf_audio_src_finalize;
   eklass->change_state = gst_gconf_audio_src_change_state;
 }
 
@@ -122,10 +124,15 @@ gst_gconf_audio_src_dispose (GObject * object)
     src->client = NULL;
   }
 
+  GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+}
+
+static void
+gst_gconf_audio_src_finalize (GstGConfAudioSrc * src)
+{
   g_free (src->gconf_str);
-  src->gconf_str = NULL;
 
-  GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+  GST_CALL_PARENT (G_OBJECT_CLASS, finalize, ((GObject *) (src)));
 }
 
 static gboolean
@@ -151,6 +158,7 @@ do_toggle_element (GstGConfAudioSrc * src)
 
   if (cur >= GST_STATE_READY || next == GST_STATE_PAUSED) {
     GST_DEBUG_OBJECT (src, "already running, ignoring GConf change");
+    g_free (new_gconf_str);
     return TRUE;
   }
 
index ed37287..e22791d 100644 (file)
@@ -27,6 +27,7 @@
 #include "gstgconfvideosink.h"
 
 static void gst_gconf_video_sink_dispose (GObject * object);
+static void gst_gconf_video_sink_finalize (GstGConfVideoSink * sink);
 static void cb_toggle_element (GConfClient * client,
     guint connection_id, GConfEntry * entry, gpointer data);
 static GstStateChangeReturn
@@ -44,7 +45,7 @@ gst_gconf_video_sink_base_init (gpointer klass)
       "Sink/Video",
       "Video sink embedding the GConf-settings for video output",
       "Ronald Bultje <rbultje@ronald.bitfreak.net>");
-  GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+  static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
       GST_PAD_SINK,
       GST_PAD_ALWAYS,
       GST_STATIC_CAPS_ANY);
@@ -61,6 +62,7 @@ gst_gconf_video_sink_class_init (GstGConfVideoSinkClass * klass)
   GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
 
   oklass->dispose = gst_gconf_video_sink_dispose;
+  oklass->finalize = (GObjectFinalizeFunc) gst_gconf_video_sink_finalize;
   eklass->change_state = gst_gconf_video_sink_change_state;
 }
 
@@ -121,6 +123,14 @@ gst_gconf_video_sink_dispose (GObject * object)
   GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
 }
 
+static void
+gst_gconf_video_sink_finalize (GstGConfVideoSink * sink)
+{
+  g_free (sink->gconf_str);
+
+  GST_CALL_PARENT (G_OBJECT_CLASS, finalize, ((GObject *) (sink)));
+}
+
 static gboolean
 do_toggle_element (GstGConfVideoSink * sink)
 {
@@ -148,6 +158,7 @@ do_toggle_element (GstGConfVideoSink * sink)
   if (cur > GST_STATE_READY || next == GST_STATE_PAUSED) {
     GST_DEBUG_OBJECT (sink,
         "Auto-sink is already running. Ignoring GConf change");
+    g_free (new_gconf_str);
     return TRUE;
   }
 
index 093545e..2735a90 100644 (file)
@@ -28,6 +28,7 @@
 #include "gstgconfvideosrc.h"
 
 static void gst_gconf_video_src_dispose (GObject * object);
+static void gst_gconf_video_src_finalize (GstGConfVideoSrc * src);
 static void cb_toggle_element (GConfClient * client,
     guint connection_id, GConfEntry * entry, gpointer data);
 static GstStateChangeReturn
@@ -45,7 +46,7 @@ gst_gconf_video_src_base_init (gpointer klass)
       "Source/Video",
       "Video source embedding the GConf-settings for video input",
       "Ronald Bultje <rbultje@ronald.bitfreak.net>");
-  GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+  static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
       GST_PAD_SRC,
       GST_PAD_ALWAYS,
       GST_STATIC_CAPS_ANY);
@@ -62,6 +63,7 @@ gst_gconf_video_src_class_init (GstGConfVideoSrcClass * klass)
   GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
 
   oklass->dispose = gst_gconf_video_src_dispose;
+  oklass->finalize = (GObjectFinalizeFunc) gst_gconf_video_src_finalize;
   eklass->change_state = gst_gconf_video_src_change_state;
 }
 
@@ -117,10 +119,15 @@ gst_gconf_video_src_dispose (GObject * object)
     src->client = NULL;
   }
 
+  GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+}
+
+static void
+gst_gconf_video_src_finalize (GstGConfVideoSrc * src)
+{
   g_free (src->gconf_str);
-  src->gconf_str = NULL;
 
-  GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
+  GST_CALL_PARENT (G_OBJECT_CLASS, finalize, ((GObject *) (src)));
 }
 
 static gboolean
@@ -128,6 +135,7 @@ do_toggle_element (GstGConfVideoSrc * src)
 {
   GstPad *targetpad;
   gchar *new_gconf_str;
+  GstState cur, next;
 
   new_gconf_str = gst_gconf_get_string (GST_GCONF_AUDIOSRC_KEY);
   if (new_gconf_str != NULL && src->gconf_str != NULL &&
@@ -138,6 +146,17 @@ do_toggle_element (GstGConfVideoSrc * src)
     return TRUE;
   }
 
+  GST_OBJECT_LOCK (src);
+  cur = GST_STATE (src);
+  next = GST_STATE_PENDING (src);
+  GST_OBJECT_UNLOCK (src);
+
+  if (cur >= GST_STATE_READY || next == GST_STATE_PAUSED) {
+    GST_DEBUG_OBJECT (src, "already running, ignoring GConf change");
+    g_free (new_gconf_str);
+    return TRUE;
+  }
+
   g_free (src->gconf_str);
   src->gconf_str = new_gconf_str;
 
index d00336e..9c09170 100644 (file)
@@ -57,7 +57,7 @@ gst_switch_sink_class_init (GstSwitchSinkClass * klass)
 {
   GObjectClass *oklass = G_OBJECT_CLASS (klass);
   GstElementClass *eklass = GST_ELEMENT_CLASS (klass);
-  GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+  static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
       GST_PAD_SINK,
       GST_PAD_ALWAYS,
       GST_STATIC_CAPS_ANY);
@@ -79,7 +79,7 @@ gst_switch_sink_class_init (GstSwitchSinkClass * klass)
 static void
 gst_switch_sink_reset (GstSwitchSink * sink)
 {
-  /* fakesink */
+  /* this will install fakesink if no other child has been set */
   if (sink->kid == NULL) {
     gst_switch_sink_set_child (sink, NULL);
   }
@@ -189,6 +189,7 @@ gst_switch_sink_set_child (GstSwitchSink * sink, GstElement * new_kid)
   if (cur == GST_STATE_PAUSED && next == GST_STATE_READY) {
     return gst_switch_commit_new_kid (sink);
   }
+
   /* Sometime, it would be lovely to allow sink changes even when
    * already running, but this involves sending an appropriate new-segment
    * and possibly prerolling etc */
index 215926b..582e15a 100644 (file)
@@ -79,7 +79,7 @@ gst_hal_audio_sink_base_init (gpointer klass)
       "Sink/Audio",
       "Audio sink for sound device access via HAL",
       "Jürg Billeter <j@bitron.ch>");
-  GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+  static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
       GST_PAD_SINK,
       GST_PAD_ALWAYS,
       GST_STATIC_CAPS_ANY);
index b745bef..ebd4470 100644 (file)
@@ -81,7 +81,7 @@ gst_hal_audio_src_base_init (gpointer klass)
       "Source/Audio",
       "Audio source for sound device access via HAL",
       "Jürg Billeter <j@bitron.ch>");
-  GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+  static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
       GST_PAD_SRC,
       GST_PAD_ALWAYS,
       GST_STATIC_CAPS_ANY);
index 68f581d..1285ced 100644 (file)
@@ -86,6 +86,7 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
 static void gst_shout2send_class_init (GstShout2sendClass * klass);
 static void gst_shout2send_base_init (GstShout2sendClass * klass);
 static void gst_shout2send_init (GstShout2send * shout2send);
+static void gst_shout2send_finalize (GstShout2send * shout2send);
 
 static gboolean gst_shout2send_event (GstBaseSink * sink, GstEvent * event);
 static GstFlowReturn gst_shout2send_render (GstBaseSink * sink,
@@ -184,6 +185,7 @@ gst_shout2send_class_init (GstShout2sendClass * klass)
 
   gobject_class->set_property = gst_shout2send_set_property;
   gobject_class->get_property = gst_shout2send_get_property;
+  gobject_class->finalize = (GObjectFinalizeFunc) gst_shout2send_finalize;
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_IP,
       g_param_spec_string ("ip", "ip", "ip", DEFAULT_IP, G_PARAM_READWRITE));
@@ -265,7 +267,23 @@ gst_shout2send_init (GstShout2send * shout2send)
   shout2send->songmetadata = NULL;
   shout2send->songartist = NULL;
   shout2send->songtitle = NULL;
+}
 
+static void
+gst_shout2send_finalize (GstShout2send * shout2send)
+{
+  g_free (shout2send->ip);
+  g_free (shout2send->password);
+  g_free (shout2send->username);
+  g_free (shout2send->streamname);
+  g_free (shout2send->description);
+  g_free (shout2send->genre);
+  g_free (shout2send->mount);
+  g_free (shout2send->url);
+
+  gst_tag_list_free (shout2send->tags);
+
+  G_OBJECT_CLASS (parent_class)->finalize ((GObject *) (shout2send));
 }
 
 static void
index 5d1dba5..c521c44 100644 (file)
@@ -62,6 +62,8 @@ struct _GstTestClass
   gchar *param_names[2 * TESTS_COUNT];
 };
 
+static void gst_test_finalize (GstTest * test);
+
 static gboolean gst_test_start (GstBaseSink * trans);
 static gboolean gst_test_stop (GstBaseSink * trans);
 static gboolean gst_test_sink_event (GstBaseSink * basesink, GstEvent * event);
@@ -107,6 +109,8 @@ gst_test_class_init (GstTestClass * klass)
   object_class->set_property = GST_DEBUG_FUNCPTR (gst_test_set_property);
   object_class->get_property = GST_DEBUG_FUNCPTR (gst_test_get_property);
 
+  object_class->finalize = (GObjectFinalizeFunc) gst_test_finalize;
+
   for (i = 0; i < TESTS_COUNT; i++) {
     GParamSpec *spec;
 
@@ -141,6 +145,18 @@ gst_test_init (GstTest * test, GstTestClass * g_class)
 }
 
 static void
+gst_test_finalize (GstTest * test)
+{
+  guint i;
+
+  for (i = 0; i < TESTS_COUNT; i++) {
+    g_value_unset (&test->values[i]);
+  }
+
+  G_OBJECT_CLASS (parent_class)->finalize ((GObject *) test);
+}
+
+static void
 tests_unset (GstTest * test)
 {
   guint i;
index ec7f198..6f9cb7f 100644 (file)
@@ -68,6 +68,7 @@ static GstStaticPadTemplate src_video_factory = GST_STATIC_PAD_TEMPLATE ("src",
 static void gst_flxdec_class_init (GstFlxDecClass * klass);
 static void gst_flxdec_base_init (GstFlxDecClass * klass);
 static void gst_flxdec_init (GstFlxDec * flxdec);
+static void gst_flxdec_dispose (GstFlxDec * flxdec);
 
 static GstFlowReturn gst_flxdec_chain (GstPad * pad, GstBuffer * buf);
 
@@ -134,6 +135,8 @@ gst_flxdec_class_init (GstFlxDecClass * klass)
 
   parent_class = g_type_class_peek_parent (klass);
 
+  gobject_class->dispose = (GObjectFinalizeFunc) gst_flxdec_dispose;
+
   GST_DEBUG_CATEGORY_INIT (flxdec_debug, "flxdec", 0, "FLX video decoder");
 
   gstelement_class->change_state = gst_flxdec_change_state;
@@ -160,6 +163,17 @@ gst_flxdec_init (GstFlxDec * flxdec)
   flxdec->adapter = gst_adapter_new ();
 }
 
+static void
+gst_flxdec_dispose (GstFlxDec * flxdec)
+{
+  if (flxdec->adapter) {
+    g_object_unref (flxdec->adapter);
+    flxdec->adapter = NULL;
+  }
+
+  G_OBJECT_CLASS (parent_class)->dispose ((GObject *) flxdec);
+}
+
 static gboolean
 gst_flxdec_src_query_handler (GstPad * pad, GstQuery * query)
 {
index e87d42a..ba9d1c0 100644 (file)
@@ -240,10 +240,10 @@ gst_multipart_mux_finalize (GObject * object)
 
   multipart_mux = GST_MULTIPART_MUX (object);
 
-  if (multipart_mux->collect) {
+  g_free (multipart_mux->boundary);
+
+  if (multipart_mux->collect)
     gst_object_unref (multipart_mux->collect);
-    multipart_mux->collect = NULL;
-  }
 
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
index 1c0ba5d..3220728 100644 (file)
@@ -184,6 +184,9 @@ gst_rtp_mp4g_pay_finalize (GObject * object)
   g_free (rtpmp4gpay->params);
   rtpmp4gpay->params = NULL;
 
+  g_free (rtpmp4gpay->profile);
+  rtpmp4gpay->profile = NULL;
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
index 9e9aa1a..cb27035 100644 (file)
@@ -288,10 +288,11 @@ gst_rtspsrc_init (GstRTSPSrc * src, GstRTSPSrcClass * g_class)
   src->location = g_strdup (DEFAULT_LOCATION);
   src->url = NULL;
 
-  /* install WMS extension by default */
-  src->extension = rtsp_ext_wms_get_context ();
 #ifdef WITH_EXT_REAL
   src->extension = rtsp_ext_real_get_context ();
+#else
+  /* install WMS extension by default */
+  src->extension = rtsp_ext_wms_get_context ();
 #endif
   src->extension->src = (gpointer) src;
 }
@@ -311,6 +312,14 @@ gst_rtspsrc_finalize (GObject * object)
   g_free (rtspsrc->content_base);
   rtsp_url_free (rtspsrc->url);
 
+  if (rtspsrc->extension) {
+#ifdef WITH_EXT_REAL
+    rtsp_ext_real_free_context (rtspsrc->extension);
+#else
+    rtsp_ext_wms_free_context (rtspsrc->extension);
+#endif
+  }
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
index 2f1fbda..30e2136 100644 (file)
@@ -178,3 +178,9 @@ rtsp_ext_wms_get_context (void)
 
   return (RTSPExtensionCtx *) res;
 }
+
+void
+rtsp_ext_wms_free_context (RTSPExtensionCtx * ctx)
+{
+  g_free (ctx);
+}
index 48f1447..3dcd65a 100644 (file)
@@ -50,6 +50,7 @@ G_BEGIN_DECLS
 #include "rtspext.h"
 
 RTSPExtensionCtx*     rtsp_ext_wms_get_context    (void);
+void  rtsp_ext_wms_free_context    (RTSPExtensionCtx *ctx);
 
 G_END_DECLS
 
index 44420ac..5d3101c 100644 (file)
@@ -163,6 +163,7 @@ gst_smpte_transition_type_get_type (void)
 static void gst_smpte_class_init (GstSMPTEClass * klass);
 static void gst_smpte_base_init (GstSMPTEClass * klass);
 static void gst_smpte_init (GstSMPTE * smpte);
+static void gst_smpte_finalize (GstSMPTE * smpte);
 
 static GstFlowReturn gst_smpte_collected (GstCollectPads * pads,
     GstSMPTE * smpte);
@@ -230,6 +231,7 @@ gst_smpte_class_init (GstSMPTEClass * klass)
 
   gobject_class->set_property = gst_smpte_set_property;
   gobject_class->get_property = gst_smpte_get_property;
+  gobject_class->finalize = (GObjectFinalizeFunc) gst_smpte_finalize;
 
   _gst_mask_init ();
 
@@ -380,6 +382,16 @@ gst_smpte_init (GstSMPTE * smpte)
 }
 
 static void
+gst_smpte_finalize (GstSMPTE * smpte)
+{
+  if (smpte->collect) {
+    gst_object_unref (smpte->collect);
+  }
+
+  G_OBJECT_CLASS (parent_class)->finalize ((GObject *) smpte);
+}
+
+static void
 gst_smpte_reset (GstSMPTE * smpte)
 {
   smpte->width = -1;
index 670162c..bcafd95 100644 (file)
@@ -92,6 +92,8 @@ static void gst_multiudpsink_set_property (GObject * object, guint prop_id,
 static void gst_multiudpsink_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
 
+static void free_client (GstUDPClient * client);
+
 static GstElementClass *parent_class = NULL;
 
 static guint gst_multiudpsink_signals[LAST_SIGNAL] = { 0 };
@@ -269,6 +271,9 @@ gst_multiudpsink_finalize (GObject * object)
 
   sink = GST_MULTIUDPSINK (object);
 
+  g_list_foreach (sink->clients, (GFunc) free_client, NULL);
+  g_list_free (sink->clients);
+
   g_mutex_free (sink->client_lock);
 
   WSA_CLEANUP (object);
index f647e60..583827d 100644 (file)
@@ -51,6 +51,7 @@ enum
 static void gst_udpsink_base_init (gpointer g_class);
 static void gst_udpsink_class_init (GstUDPSink * klass);
 static void gst_udpsink_init (GstUDPSink * udpsink);
+static void gst_udpsink_finalize (GstUDPSink * udpsink);
 
 static void gst_udpsink_uri_handler_init (gpointer g_iface,
     gpointer iface_data);
@@ -123,6 +124,8 @@ gst_udpsink_class_init (GstUDPSink * klass)
   gobject_class->set_property = gst_udpsink_set_property;
   gobject_class->get_property = gst_udpsink_get_property;
 
+  gobject_class->finalize = (GObjectFinalizeFunc) gst_udpsink_finalize;
+
   g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_HOST,
       g_param_spec_string ("host", "host",
           "The host/IP/Multicast group to send the packets to",
@@ -142,6 +145,14 @@ gst_udpsink_init (GstUDPSink * udpsink)
       udpsink->port);
 }
 
+static void
+gst_udpsink_finalize (GstUDPSink * udpsink)
+{
+  g_free (udpsink->host);
+
+  G_OBJECT_CLASS (parent_class)->finalize ((GObject *) udpsink);
+}
+
 static gboolean
 gst_udpsink_set_uri (GstUDPSink * sink, const gchar * uri)
 {
index ade334a..00da901 100644 (file)
@@ -182,7 +182,7 @@ gst_wavparse_dispose (GObject * object)
 {
   GstWavParse *wav;
 
-  GST_DEBUG ("WAV: Dispose\n");
+  GST_DEBUG ("WAV: Dispose");
   wav = GST_WAVPARSE (object);
 
   if (wav->adapter) {
@@ -1957,6 +1957,9 @@ gst_wavparse_sink_activate (GstPad * sinkpad)
   GstWavParse *wav = GST_WAVPARSE (gst_pad_get_parent (sinkpad));
   gboolean res;
 
+  if (wav->adapter)
+    gst_object_unref (wav->adapter);
+
   if (gst_pad_check_pull_range (sinkpad)) {
     GST_DEBUG ("going to pull mode");
     wav->streaming = FALSE;
index 1351d1b..9f2a7ea 100644 (file)
@@ -247,6 +247,8 @@ gst_oss_sink_finalise (GObject * object)
   GstOssSink *osssink = GST_OSSSINK (object);
 
   g_free (osssink->device);
+
+  G_OBJECT_CLASS (parent_class)->finalize ((GObject *) (object));
 }
 
 static void
index 26eb6c6..34d901a 100644 (file)
@@ -97,6 +97,7 @@ static void gst_oss_src_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
 
 static void gst_oss_src_dispose (GObject * object);
+static void gst_oss_src_finalize (GstOssSrc * osssrc);
 
 static GstCaps *gst_oss_src_getcaps (GstBaseSrc * bsrc);
 
@@ -160,6 +161,8 @@ gst_oss_src_class_init (GstOssSrcClass * klass)
   gstaudiosrc_class = (GstAudioSrcClass *) klass;
 
   gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_oss_src_dispose);
+  gobject_class->finalize =
+      (GObjectFinalizeFunc) GST_DEBUG_FUNCPTR (gst_oss_src_finalize);
   gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_oss_src_get_property);
   gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_oss_src_set_property);
 
@@ -234,6 +237,15 @@ gst_oss_src_init (GstOssSrc * osssrc, GstOssSrcClass * g_class)
   osssrc->device_name = g_strdup (DEFAULT_DEVICE_NAME);
 }
 
+static void
+gst_oss_src_finalize (GstOssSrc * osssrc)
+{
+  g_free (osssrc->device);
+  g_free (osssrc->device_name);
+
+  G_OBJECT_CLASS (parent_class)->finalize ((GObject *) (osssrc));
+}
+
 static GstCaps *
 gst_oss_src_getcaps (GstBaseSrc * bsrc)
 {
index 48497fc..c842e8b 100644 (file)
@@ -278,17 +278,14 @@ gst_v4l2_object_new (GstElement * element,
 }
 
 void
-gst_v4l2_object_destroy (GstV4l2Object ** v4l2object)
+gst_v4l2_object_destroy (GstV4l2Object * v4l2object)
 {
-  if (*v4l2object) {
-    if ((*v4l2object)->videodev) {
-      g_free ((*v4l2object)->videodev);
-      (*v4l2object)->videodev = NULL;
-    }
+  g_return_if_fail (v4l2object != NULL);
 
-    g_free (*v4l2object);
-    *v4l2object = NULL;
-  }
+  if (v4l2object->videodev)
+    g_free (v4l2object->videodev);
+
+  g_free (v4l2object);
 }
 
 gboolean
index 906cff9..f309bc7 100644 (file)
@@ -117,7 +117,7 @@ GstV4l2Object *     gst_v4l2_object_new              (GstElement * element,
                                                  GstV4l2GetInOutFunction get_in_out_func,
                                                  GstV4l2SetInOutFunction set_in_out_func,
                                                  GstV4l2UpdateFpsFunction   update_fps_func);
-void           gst_v4l2_object_destroy          (GstV4l2Object ** v4l2object);
+void           gst_v4l2_object_destroy          (GstV4l2Object * v4l2object);
 
 /* properties */
 void     gst_v4l2_object_install_properties_helper (GObjectClass *gobject_class);
index 4aeb6f1..cddad93 100644 (file)
@@ -223,6 +223,7 @@ GST_BOILERPLATE_FULL (GstV4l2Src, gst_v4l2src, GstPushSrc, GST_TYPE_PUSH_SRC,
     gst_v4l2src_init_interfaces);
 
 static void gst_v4l2src_dispose (GObject * object);
+static void gst_v4l2src_finalize (GstV4l2Src * v4l2src);
 
 /* basesrc methods */
 static gboolean gst_v4l2src_start (GstBaseSrc * src);
@@ -270,6 +271,7 @@ gst_v4l2src_class_init (GstV4l2SrcClass * klass)
   pushsrc_class = GST_PUSH_SRC_CLASS (klass);
 
   gobject_class->dispose = gst_v4l2src_dispose;
+  gobject_class->finalize = (GObjectFinalizeFunc) gst_v4l2src_finalize;
   gobject_class->set_property = gst_v4l2src_set_property;
   gobject_class->get_property = gst_v4l2src_get_property;
 
@@ -325,6 +327,13 @@ gst_v4l2src_dispose (GObject * object)
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
+static void
+gst_v4l2src_finalize (GstV4l2Src * v4l2src)
+{
+  gst_v4l2_object_destroy (v4l2src->v4l2object);
+
+  G_OBJECT_CLASS (parent_class)->finalize ((GObject *) (v4l2src));
+}
 
 static void
 gst_v4l2src_set_property (GObject * object,
index ba4d52f..d695837 100644 (file)
@@ -339,7 +339,6 @@ static GstXImageSrcBuffer *
 gst_ximage_src_ximage_get (GstXImageSrc * ximagesrc)
 {
   GstXImageSrcBuffer *ximage = NULL;
-  GstCaps *caps = NULL;
 
   g_mutex_lock (ximagesrc->pool_lock);
   while (ximagesrc->buffer_pool != NULL) {
@@ -357,6 +356,7 @@ gst_ximage_src_ximage_get (GstXImageSrc * ximagesrc)
 
   if (ximage == NULL) {
     GstXContext *xcontext;
+    GstCaps *caps = NULL;
 
     GST_DEBUG_OBJECT (ximagesrc, "creating image (%dx%d)",
         ximagesrc->width, ximagesrc->height);
@@ -391,6 +391,8 @@ gst_ximage_src_ximage_get (GstXImageSrc * ximagesrc)
 
     gst_buffer_set_caps (GST_BUFFER (ximage), caps);
     g_mutex_unlock (ximagesrc->x_lock);
+
+    gst_caps_unref (caps);
   }
 
   g_return_val_if_fail (GST_IS_XIMAGE_SRC (ximagesrc), NULL);