diff options
author | Jan Schmidt <thaytan@mad.scientist.com> | 2007-03-04 13:52:03 +0000 |
---|---|---|
committer | Jan Schmidt <thaytan@mad.scientist.com> | 2007-03-04 13:52:03 +0000 |
commit | de1357a4074d7cab9df163237bcfbce653d417e7 (patch) | |
tree | fe0a5f3335039c705d0d7c1b2f1c2367eac4231e /gst | |
parent | 382d7f0ba54a4752275446e613b1b295203e9dbf (diff) |
Fix a bunch of leaks shown by the newly-added states test.
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.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/debug/testplugin.c | 16 | ||||
-rw-r--r-- | gst/flx/gstflxdec.c | 14 | ||||
-rw-r--r-- | gst/multipart/multipartmux.c | 6 | ||||
-rw-r--r-- | gst/rtp/gstrtpmp4gpay.c | 3 | ||||
-rw-r--r-- | gst/rtsp/gstrtspsrc.c | 13 | ||||
-rw-r--r-- | gst/rtsp/rtspextwms.c | 6 | ||||
-rw-r--r-- | gst/rtsp/rtspextwms.h | 1 | ||||
-rw-r--r-- | gst/smpte/gstsmpte.c | 12 | ||||
-rw-r--r-- | gst/udp/gstmultiudpsink.c | 5 | ||||
-rw-r--r-- | gst/udp/gstudpsink.c | 11 | ||||
-rw-r--r-- | gst/wavparse/gstwavparse.c | 5 |
11 files changed, 86 insertions, 6 deletions
diff --git a/gst/debug/testplugin.c b/gst/debug/testplugin.c index 5d1dba53..c521c44c 100644 --- a/gst/debug/testplugin.c +++ b/gst/debug/testplugin.c @@ -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; diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c index ec7f1981..6f9cb7fe 100644 --- a/gst/flx/gstflxdec.c +++ b/gst/flx/gstflxdec.c @@ -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) { diff --git a/gst/multipart/multipartmux.c b/gst/multipart/multipartmux.c index e87d42aa..ba9d1c05 100644 --- a/gst/multipart/multipartmux.c +++ b/gst/multipart/multipartmux.c @@ -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); } diff --git a/gst/rtp/gstrtpmp4gpay.c b/gst/rtp/gstrtpmp4gpay.c index 1c0ba5d8..3220728f 100644 --- a/gst/rtp/gstrtpmp4gpay.c +++ b/gst/rtp/gstrtpmp4gpay.c @@ -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); } diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 9e9aa1a5..cb27035c 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -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); } diff --git a/gst/rtsp/rtspextwms.c b/gst/rtsp/rtspextwms.c index 2f1fbdaa..30e21362 100644 --- a/gst/rtsp/rtspextwms.c +++ b/gst/rtsp/rtspextwms.c @@ -178,3 +178,9 @@ rtsp_ext_wms_get_context (void) return (RTSPExtensionCtx *) res; } + +void +rtsp_ext_wms_free_context (RTSPExtensionCtx * ctx) +{ + g_free (ctx); +} diff --git a/gst/rtsp/rtspextwms.h b/gst/rtsp/rtspextwms.h index 48f14472..3dcd65ae 100644 --- a/gst/rtsp/rtspextwms.h +++ b/gst/rtsp/rtspextwms.h @@ -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 diff --git a/gst/smpte/gstsmpte.c b/gst/smpte/gstsmpte.c index 44420ac8..5d3101cc 100644 --- a/gst/smpte/gstsmpte.c +++ b/gst/smpte/gstsmpte.c @@ -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; diff --git a/gst/udp/gstmultiudpsink.c b/gst/udp/gstmultiudpsink.c index 670162c0..bcafd95f 100644 --- a/gst/udp/gstmultiudpsink.c +++ b/gst/udp/gstmultiudpsink.c @@ -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); diff --git a/gst/udp/gstudpsink.c b/gst/udp/gstudpsink.c index f647e60c..583827dd 100644 --- a/gst/udp/gstudpsink.c +++ b/gst/udp/gstudpsink.c @@ -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) { diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index ade334a8..00da9015 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -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; |