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 /sys | |
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 'sys')
-rw-r--r-- | sys/oss/gstosssink.c | 2 | ||||
-rw-r--r-- | sys/oss/gstosssrc.c | 12 | ||||
-rw-r--r-- | sys/v4l2/gstv4l2object.c | 15 | ||||
-rw-r--r-- | sys/v4l2/gstv4l2object.h | 2 | ||||
-rw-r--r-- | sys/v4l2/gstv4l2src.c | 9 | ||||
-rw-r--r-- | sys/ximage/gstximagesrc.c | 4 |
6 files changed, 33 insertions, 11 deletions
diff --git a/sys/oss/gstosssink.c b/sys/oss/gstosssink.c index 1351d1b9..9f2a7eae 100644 --- a/sys/oss/gstosssink.c +++ b/sys/oss/gstosssink.c @@ -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 diff --git a/sys/oss/gstosssrc.c b/sys/oss/gstosssrc.c index 26eb6c6f..34d901a2 100644 --- a/sys/oss/gstosssrc.c +++ b/sys/oss/gstosssrc.c @@ -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) { diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 48497fc7..c842e8b9 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -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 diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h index 906cff99..f309bc7d 100644 --- a/sys/v4l2/gstv4l2object.h +++ b/sys/v4l2/gstv4l2object.h @@ -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); diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 4aeb6f1e..cddad936 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -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, diff --git a/sys/ximage/gstximagesrc.c b/sys/ximage/gstximagesrc.c index ba4d52f4..d695837f 100644 --- a/sys/ximage/gstximagesrc.c +++ b/sys/ximage/gstximagesrc.c @@ -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); |