From 1af510f8d54ddeb58f1c8e6db3f4fe45d21dd026 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Mon, 24 Sep 2007 10:53:37 +0000 Subject: Massive leak fixing, plus code cleanups. Original commit message from CVS: * ext/audioresample/gstaudioresample.c: * ext/x264/gstx264enc.c: * gst/dvdspu/gstdvdspu.c: * gst/dvdspu/gstdvdspu.h: * gst/festival/gstfestival.c: * gst/h264parse/gsth264parse.c: * gst/mpegtsparse/mpegtspacketizer.c: * gst/mpegtsparse/mpegtsparse.c: * gst/multifile/gstmultifilesink.c: * gst/multifile/gstmultifilesrc.c: * gst/nuvdemux/gstnuvdemux.c: * sys/dshowsrcwrapper/gstdshowaudiosrc.c: * sys/dshowsrcwrapper/gstdshowvideosrc.c: * sys/vcd/vcdsrc.c: Massive leak fixing, plus code cleanups. --- ChangeLog | 18 +++++++ ext/audioresample/gstaudioresample.c | 9 ++-- ext/x264/gstx264enc.c | 3 +- gst/dvdspu/gstdvdspu.c | 99 +++++++++++++++++++++------------- gst/dvdspu/gstdvdspu.h | 30 +++++------ gst/festival/gstfestival.c | 20 ++++++- gst/h264parse/gsth264parse.c | 2 + gst/mpegtsparse/mpegtspacketizer.c | 6 +-- gst/mpegtsparse/mpegtsparse.c | 6 +-- gst/multifile/gstmultifilesink.c | 4 +- gst/multifile/gstmultifilesrc.c | 4 +- gst/nuvdemux/gstnuvdemux.c | 9 +++- sys/dshowsrcwrapper/gstdshowaudiosrc.c | 2 + sys/dshowsrcwrapper/gstdshowvideosrc.c | 8 +-- sys/vcd/vcdsrc.c | 13 +++++ 15 files changed, 155 insertions(+), 78 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ebb248d..72a3b6d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2007-09-24 Stefan Kost + + * ext/audioresample/gstaudioresample.c: + * ext/x264/gstx264enc.c: + * gst/dvdspu/gstdvdspu.c: + * gst/dvdspu/gstdvdspu.h: + * gst/festival/gstfestival.c: + * gst/h264parse/gsth264parse.c: + * gst/mpegtsparse/mpegtspacketizer.c: + * gst/mpegtsparse/mpegtsparse.c: + * gst/multifile/gstmultifilesink.c: + * gst/multifile/gstmultifilesrc.c: + * gst/nuvdemux/gstnuvdemux.c: + * sys/dshowsrcwrapper/gstdshowaudiosrc.c: + * sys/dshowsrcwrapper/gstdshowvideosrc.c: + * sys/vcd/vcdsrc.c: + Massive leak fixing, plus code cleanups. + 2007-09-22 Thomas Vander Stichele * po/LINGUAS: diff --git a/ext/audioresample/gstaudioresample.c b/ext/audioresample/gstaudioresample.c index 6b63db33..8971824a 100644 --- a/ext/audioresample/gstaudioresample.c +++ b/ext/audioresample/gstaudioresample.c @@ -61,15 +61,16 @@ enum "endianness = (int) BYTE_ORDER, " \ "width = (int) 16, " \ "depth = (int) 16, " \ - "signed = (boolean) true") - + "signed = (boolean) true" #if 0 - /* disabled because it segfaults */ + /* disabled because it segfaults */ "audio/x-raw-float, " "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ], " - "endianness = (int) BYTE_ORDER, " "width = (int) 32") + "endianness = (int) BYTE_ORDER, " "width = (int) 32" #endif + ) + static GstStaticPadTemplate gst_audioresample_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, SUPPORTED_CAPS); diff --git a/ext/x264/gstx264enc.c b/ext/x264/gstx264enc.c index 4841755a..21693b8d 100644 --- a/ext/x264/gstx264enc.c +++ b/ext/x264/gstx264enc.c @@ -664,10 +664,9 @@ gst_x264_enc_dispose (GObject * object) encoder->buffer = NULL; gst_x264_enc_timestamp_queue_free (encoder); + gst_x264_enc_close_encoder (encoder); G_OBJECT_CLASS (parent_class)->dispose (object); - - gst_x264_enc_close_encoder (encoder); } static gboolean diff --git a/gst/dvdspu/gstdvdspu.c b/gst/dvdspu/gstdvdspu.c index aca4a3bf..bb4c40e4 100644 --- a/gst/dvdspu/gstdvdspu.c +++ b/gst/dvdspu/gstdvdspu.c @@ -16,6 +16,22 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ +/* + * SECTION:element-dvdspu + * + * + * + * DVD sub picture overlay element. + * + * Example launch line + * + * + * FIXME: gst-launch ... + * + * FIXME: description for the sample launch pipeline + * + * + */ #ifdef HAVE_CONFIG_H # include #endif @@ -65,8 +81,8 @@ GST_STATIC_PAD_TEMPLATE ("subpicture", GST_BOILERPLATE (GstDVDSpu, dvdspu, GstElement, GST_TYPE_ELEMENT); -static void dvdspu_dispose (GstDVDSpu * dvdspu); -static void dvdspu_finalize (GstDVDSpu * dvdspu); +static void dvdspu_dispose (GObject * object); +static void dvdspu_finalize (GObject * object); static GstStateChangeReturn dvdspu_change_state (GstElement * element, GstStateChange transition); @@ -172,17 +188,22 @@ dvdspu_clear (GstDVDSpu * dvdspu) } static void -dvdspu_dispose (GstDVDSpu * dvdspu) +dvdspu_dispose (GObject * object) { + GstDVDSpu *dvdspu = DVD_SPU (object); + /* need to hold the SPU lock in case other stuff is still running... */ - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); dvdspu_clear (dvdspu); - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); + + G_OBJECT_CLASS (parent_class)->dispose (object); } static void -dvdspu_finalize (GstDVDSpu * dvdspu) +dvdspu_finalize (GObject * object) { + GstDVDSpu *dvdspu = DVD_SPU (object); gint i; for (i = 0; i < 3; i++) { @@ -193,6 +214,8 @@ dvdspu_finalize (GstDVDSpu * dvdspu) } g_queue_free (dvdspu->pending_spus); g_mutex_free (dvdspu->spu_lock); + + G_OBJECT_CLASS (parent_class)->finalize (object); } /* With SPU lock held, clear the queue of SPU packets */ @@ -253,7 +276,7 @@ static GstFlowReturn dvdspu_buffer_alloc (GstPad * sinkpad, guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf) { - GstDVDSpu *dvdspu = GSTDVDSPU (gst_pad_get_parent (sinkpad)); + GstDVDSpu *dvdspu = DVD_SPU (gst_pad_get_parent (sinkpad)); GstFlowReturn ret = GST_FLOW_OK; ret = gst_pad_alloc_buffer (dvdspu->srcpad, offset, size, caps, buf); @@ -266,7 +289,7 @@ dvdspu_buffer_alloc (GstPad * sinkpad, guint64 offset, guint size, static gboolean dvdspu_src_event (GstPad * pad, GstEvent * event) { - GstDVDSpu *dvdspu = GSTDVDSPU (gst_pad_get_parent (pad)); + GstDVDSpu *dvdspu = DVD_SPU (gst_pad_get_parent (pad)); GstPad *peer; gboolean res = TRUE; @@ -283,7 +306,7 @@ dvdspu_src_event (GstPad * pad, GstEvent * event) static gboolean dvdspu_video_set_caps (GstPad * pad, GstCaps * caps) { - GstDVDSpu *dvdspu = GSTDVDSPU (gst_pad_get_parent (pad)); + GstDVDSpu *dvdspu = DVD_SPU (gst_pad_get_parent (pad)); gboolean res = FALSE; GstStructure *s; gint w, h; @@ -299,7 +322,7 @@ dvdspu_video_set_caps (GstPad * pad, GstCaps * caps) goto done; } - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); state = &dvdspu->spu_state; @@ -319,7 +342,7 @@ dvdspu_video_set_caps (GstPad * pad, GstCaps * caps) sizeof (guint16) * state->UV_stride); } } - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); res = TRUE; done: @@ -330,7 +353,7 @@ done: static GstCaps * dvdspu_video_proxy_getcaps (GstPad * pad) { - GstDVDSpu *dvdspu = GSTDVDSPU (gst_pad_get_parent (pad)); + GstDVDSpu *dvdspu = DVD_SPU (gst_pad_get_parent (pad)); GstCaps *caps; GstPad *otherpad; @@ -384,7 +407,7 @@ dvdspu_video_event (GstPad * pad, GstEvent * event) gboolean in_still; if (gst_structure_get_boolean (structure, "still-state", &in_still)) { - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); if (in_still) { state->flags |= SPU_STATE_STILL_FRAME; /* Entering still. Advance the SPU to make sure the state is @@ -396,7 +419,7 @@ dvdspu_video_event (GstPad * pad, GstEvent * event) dvdspu_redraw_still (dvdspu); } else state->flags &= ~(SPU_STATE_STILL_FRAME); - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); } gst_event_unref (event); res = TRUE; @@ -425,7 +448,7 @@ dvdspu_video_event (GstPad * pad, GstEvent * event) update, rate, arate, format, GST_TIME_ARGS (start), GST_TIME_ARGS (stop), GST_TIME_ARGS (time)); - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); if (update && start > dvdspu->video_seg.last_stop) { #if 0 @@ -435,19 +458,19 @@ dvdspu_video_event (GstPad * pad, GstEvent * event) #endif while (dvdspu->video_seg.last_stop < start && !(state->flags & SPU_STATE_STILL_FRAME)) { - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); if (dvspu_handle_vid_buffer (dvdspu, NULL) != GST_FLOW_OK) { - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); break; } - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); } } gst_segment_set_newsegment_full (&dvdspu->video_seg, update, rate, arate, format, start, stop, time); - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); res = gst_pad_event_default (pad, event); break; @@ -458,12 +481,12 @@ dvdspu_video_event (GstPad * pad, GstEvent * event) case GST_EVENT_FLUSH_STOP: res = gst_pad_event_default (pad, event); - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); gst_segment_init (&dvdspu->video_seg, GST_FORMAT_UNDEFINED); gst_buffer_replace (&dvdspu->ref_frame, NULL); gst_buffer_replace (&dvdspu->pending_frame, NULL); - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); goto done; default: res = gst_pad_event_default (pad, event); @@ -505,7 +528,7 @@ dvspu_handle_vid_buffer (GstDVDSpu * dvdspu, GstBuffer * buf) GstFlowReturn ret; gboolean using_ref = FALSE; - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); if (buf == NULL) { GstClockTime next_ts = dvdspu->video_seg.last_stop; @@ -581,7 +604,7 @@ dvspu_handle_vid_buffer (GstDVDSpu * dvdspu, GstBuffer * buf) GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf))); } - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); /* just push out the incoming buffer without touching it */ ret = gst_pad_push (dvdspu->srcpad, buf); @@ -590,7 +613,7 @@ dvspu_handle_vid_buffer (GstDVDSpu * dvdspu, GstBuffer * buf) no_ref_frame: - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); return GST_FLOW_OK; } @@ -1122,7 +1145,7 @@ dvdspu_subpic_chain (GstPad * pad, GstBuffer * buf) GST_TIME_FORMAT " and size %u", GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)), GST_BUFFER_SIZE (buf)); - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); if (GST_BUFFER_TIMESTAMP_IS_VALID (buf)) { gst_segment_set_last_stop (&dvdspu->subp_seg, GST_FORMAT_TIME, @@ -1215,7 +1238,7 @@ dvdspu_subpic_chain (GstPad * pad, GstBuffer * buf) } } - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); gst_object_unref (dvdspu); return GST_FLOW_OK; @@ -1243,7 +1266,7 @@ dvdspu_subpic_event (GstPad * pad, GstEvent * event) break; } - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); if (GST_EVENT_IS_SERIALIZED (event)) { SpuPacket *spu_packet = g_new0 (SpuPacket, 1); @@ -1258,7 +1281,7 @@ dvdspu_subpic_event (GstPad * pad, GstEvent * event) * This requires some dancing to preserve locking order and handle * flushes correctly */ need_push = (dvdspu->pending_frame != NULL); - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); if (need_push) { GstBuffer *to_push = NULL; gboolean flushing; @@ -1270,15 +1293,15 @@ dvdspu_subpic_event (GstPad * pad, GstEvent * event) flushing = GST_PAD_IS_FLUSHING (dvdspu->videosinkpad); GST_OBJECT_UNLOCK (dvdspu->videosinkpad); - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); if (dvdspu->pending_frame == NULL || flushing) { /* Got flushed while waiting for the stream lock */ - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); } else { to_push = dvdspu->pending_frame; dvdspu->pending_frame = NULL; - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); gst_pad_push (dvdspu->srcpad, to_push); } GST_LOG_OBJECT (dvdspu, "Dropping stream lock"); @@ -1306,10 +1329,10 @@ dvdspu_subpic_event (GstPad * pad, GstEvent * event) update, rate, arate, format, GST_TIME_ARGS (start), GST_TIME_ARGS (stop), GST_TIME_ARGS (time)); - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); gst_segment_set_newsegment_full (&dvdspu->subp_seg, update, rate, arate, format, start, stop, time); - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); gst_event_unref (event); break; @@ -1318,9 +1341,9 @@ dvdspu_subpic_event (GstPad * pad, GstEvent * event) gst_event_unref (event); goto done; case GST_EVENT_FLUSH_STOP: - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); dvdspu_flush_spu_info (dvdspu); - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); /* We don't forward flushes on the spu pad */ gst_event_unref (event); @@ -1346,9 +1369,9 @@ dvdspu_change_state (GstElement * element, GstStateChange transition) switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: - GSTDVDSPU_LOCK (dvdspu); + DVD_SPU_LOCK (dvdspu); dvdspu_clear (dvdspu); - GSTDVDSPU_UNLOCK (dvdspu); + DVD_SPU_UNLOCK (dvdspu); break; default: break; @@ -1364,7 +1387,7 @@ gstdvdspu_plugin_init (GstPlugin * plugin) 0, "DVD Sub-picture Overlay decoder/renderer"); return gst_element_register (plugin, "dvdspu", - GST_RANK_NONE, GST_TYPE_GSTDVDSPU); + GST_RANK_NONE, GST_TYPE_DVD_SPU); } GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, diff --git a/gst/dvdspu/gstdvdspu.h b/gst/dvdspu/gstdvdspu.h index 46923a58..8710aeb7 100644 --- a/gst/dvdspu/gstdvdspu.h +++ b/gst/dvdspu/gstdvdspu.h @@ -16,26 +16,26 @@ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ -#ifndef __GSTDVDSPU_H__ -#define __GSTDVDSPU_H__ +#ifndef __DVD_SPU_H__ +#define __DVD_SPU_H__ #include G_BEGIN_DECLS -#define GST_TYPE_GSTDVDSPU \ +#define GST_TYPE_DVD_SPU \ (dvdspu_get_type()) -#define GSTDVDSPU(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GSTDVDSPU,GstDVDSpu)) -#define GSTDVDSPU_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GSTDVDSPU,GstDVDSpuClass)) -#define GST_IS_PLUGIN_TEMPLATE(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GSTDVDSPU)) -#define GST_IS_PLUGIN_TEMPLATE_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GSTDVDSPU)) - -#define GSTDVDSPU_LOCK(s) g_mutex_lock ((s)->spu_lock); -#define GSTDVDSPU_UNLOCK(s) g_mutex_unlock ((s)->spu_lock); +#define DVD_SPU(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DVD_SPU,GstDVDSpu)) +#define DVD_SPU_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DVD_SPU,GstDVDSpuClass)) +#define GST_IS_DVD_SPU(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DVD_SPU)) +#define GST_IS_DVD_SPU_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DVD_SPU)) + +#define DVD_SPU_LOCK(s) g_mutex_lock ((s)->spu_lock); +#define DVD_SPU_UNLOCK(s) g_mutex_unlock ((s)->spu_lock); typedef struct GstDVDSpu GstDVDSpu; typedef struct GstDVDSpuClass GstDVDSpuClass; @@ -223,4 +223,4 @@ void gstdvdspu_render_spu (GstDVDSpu *dvdspu, GstBuffer *buf); G_END_DECLS -#endif /* __GSTDVDSPU_H__ */ +#endif /* __DVD_SPU_H__ */ diff --git a/gst/festival/gstfestival.c b/gst/festival/gstfestival.c index 0d8395c9..7a147c95 100644 --- a/gst/festival/gstfestival.c +++ b/gst/festival/gstfestival.c @@ -97,6 +97,8 @@ GST_DEBUG_CATEGORY_STATIC (festival_debug); #define GST_CAT_DEFAULT festival_debug +static void gst_festival_finalize (GObject * object); + static void gst_festival_base_init (gpointer g_class); static void gst_festival_class_init (GstFestivalClass * klass); static void gst_festival_init (GstFestival * festival); @@ -189,13 +191,17 @@ gst_festival_base_init (gpointer g_class) static void gst_festival_class_init (GstFestivalClass * klass) { + GObjectClass *gobject_class; GstElementClass *gstelement_class; - gstelement_class = (GstElementClass *) klass; + gobject_class = G_OBJECT_CLASS (klass); + gstelement_class = GST_ELEMENT_CLASS (klass); parent_class = g_type_class_peek_parent (klass); - gstelement_class->change_state = gst_festival_change_state; + gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_festival_finalize); + gstelement_class->change_state = + GST_DEBUG_FUNCPTR (gst_festival_change_state); } static void @@ -213,6 +219,16 @@ gst_festival_init (GstFestival * festival) festival->info = festival_default_info (); } +static void +gst_festival_finalize (GObject * object) +{ + GstFestival *festival = GST_FESTIVAL (object); + + g_free (festival->info); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + static gboolean read_response (GstFestival * festival) { diff --git a/gst/h264parse/gsth264parse.c b/gst/h264parse/gsth264parse.c index ca1d8ea3..fef7ddfc 100644 --- a/gst/h264parse/gsth264parse.c +++ b/gst/h264parse/gsth264parse.c @@ -75,6 +75,8 @@ gst_h264_parse_finalize (GObject * object) h264parse = GST_H264PARSE (object); + g_object_unref (h264parse->adapter); + G_OBJECT_CLASS (parent_class)->finalize (object); } diff --git a/gst/mpegtsparse/mpegtspacketizer.c b/gst/mpegtsparse/mpegtspacketizer.c index 7e51f1eb..1530c10d 100644 --- a/gst/mpegtsparse/mpegtspacketizer.c +++ b/gst/mpegtsparse/mpegtspacketizer.c @@ -103,8 +103,7 @@ mpegts_packetizer_dispose (GObject * object) packetizer->disposed = TRUE; } - if (G_OBJECT_CLASS (mpegts_packetizer_parent_class)->dispose) - G_OBJECT_CLASS (mpegts_packetizer_parent_class)->dispose (object); + G_OBJECT_CLASS (mpegts_packetizer_parent_class)->dispose (object); } static gboolean @@ -127,8 +126,7 @@ mpegts_packetizer_finalize (GObject * object) stream_foreach_remove, packetizer); g_hash_table_destroy (packetizer->streams); - if (G_OBJECT_CLASS (mpegts_packetizer_parent_class)->finalize) - G_OBJECT_CLASS (mpegts_packetizer_parent_class)->finalize (object); + G_OBJECT_CLASS (mpegts_packetizer_parent_class)->finalize (object); } static gboolean diff --git a/gst/mpegtsparse/mpegtsparse.c b/gst/mpegtsparse/mpegtsparse.c index 13ba609e..0d0a4232 100644 --- a/gst/mpegtsparse/mpegtsparse.c +++ b/gst/mpegtsparse/mpegtsparse.c @@ -241,8 +241,7 @@ mpegts_parse_dispose (GObject * object) parse->disposed = TRUE; } - if (G_OBJECT_CLASS (parent_class)->dispose) - G_OBJECT_CLASS (parent_class)->dispose (object); + G_OBJECT_CLASS (parent_class)->dispose (object); } static void @@ -256,8 +255,7 @@ mpegts_parse_finalize (GObject * object) g_hash_table_destroy (parse->programs); g_hash_table_destroy (parse->psi_pids); - if (G_OBJECT_CLASS (parent_class)->finalize) - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (parent_class)->finalize (object); } static void diff --git a/gst/multifile/gstmultifilesink.c b/gst/multifile/gstmultifilesink.c index 58977817..9280f1f5 100644 --- a/gst/multifile/gstmultifilesink.c +++ b/gst/multifile/gstmultifilesink.c @@ -142,10 +142,10 @@ gst_multi_file_sink_dispose (GObject * object) { GstMultiFileSink *sink = GST_MULTI_FILE_SINK (object); - G_OBJECT_CLASS (parent_class)->dispose (object); - g_free (sink->filename); sink->filename = NULL; + + G_OBJECT_CLASS (parent_class)->dispose (object); } static gboolean diff --git a/gst/multifile/gstmultifilesrc.c b/gst/multifile/gstmultifilesrc.c index 43e449d5..57d02c67 100644 --- a/gst/multifile/gstmultifilesrc.c +++ b/gst/multifile/gstmultifilesrc.c @@ -147,12 +147,12 @@ gst_multi_file_src_dispose (GObject * object) { GstMultiFileSrc *src = GST_MULTI_FILE_SRC (object); - G_OBJECT_CLASS (parent_class)->dispose (object); - g_free (src->filename); src->filename = NULL; if (src->caps) gst_caps_unref (src->caps); + + G_OBJECT_CLASS (parent_class)->dispose (object); } static GstCaps * diff --git a/gst/nuvdemux/gstnuvdemux.c b/gst/nuvdemux/gstnuvdemux.c index 219a580a..20ba7538 100644 --- a/gst/nuvdemux/gstnuvdemux.c +++ b/gst/nuvdemux/gstnuvdemux.c @@ -802,11 +802,16 @@ gst_nuv_demux_sink_activate (GstPad * sinkpad) if (gst_pad_check_pull_range (sinkpad)) { nuv->mode = 0; - nuv->adapter = NULL; + if (nuv->adapter != NULL) { + gst_object_unref (nuv->adapter); + nuv->adapter = NULL; + } res = gst_pad_activate_pull (sinkpad, TRUE); } else { nuv->mode = 1; - nuv->adapter = gst_adapter_new (); + if (!nuv->adapter) { + nuv->adapter = gst_adapter_new (); + } res = gst_pad_activate_push (sinkpad, TRUE); } diff --git a/sys/dshowsrcwrapper/gstdshowaudiosrc.c b/sys/dshowsrcwrapper/gstdshowaudiosrc.c index 87c12789..4d960e64 100644 --- a/sys/dshowsrcwrapper/gstdshowaudiosrc.c +++ b/sys/dshowsrcwrapper/gstdshowaudiosrc.c @@ -239,6 +239,8 @@ gst_dshowaudiosrc_dispose (GObject * gobject) } CoUninitialize (); + + G_OBJECT_CLASS (parent_class)->dispose (object); } diff --git a/sys/dshowsrcwrapper/gstdshowvideosrc.c b/sys/dshowsrcwrapper/gstdshowvideosrc.c index 38b779dd..72fbc58b 100644 --- a/sys/dshowsrcwrapper/gstdshowvideosrc.c +++ b/sys/dshowsrcwrapper/gstdshowvideosrc.c @@ -35,9 +35,9 @@ GST_DEBUG_CATEGORY_STATIC (dshowvideosrc_debug); #define GST_CAT_DEFAULT dshowvideosrc_debug const GUID MEDIASUBTYPE_I420 - = - { 0x30323449, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, - 0x71} }; + = { 0x30323449, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, + 0x71} +}; static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, @@ -245,6 +245,8 @@ gst_dshowvideosrc_dispose (GObject * gobject) } CoUninitialize (); + + G_OBJECT_CLASS (parent_class)->dispose (object); } static gboolean diff --git a/sys/vcd/vcdsrc.c b/sys/vcd/vcdsrc.c index b48e307b..0ccebc33 100644 --- a/sys/vcd/vcdsrc.c +++ b/sys/vcd/vcdsrc.c @@ -83,6 +83,8 @@ gst_vcdsrc_setup_interfaces (GType type) GST_BOILERPLATE_FULL (GstVCDSrc, gst_vcdsrc, GstPushSrc, GST_TYPE_PUSH_SRC, gst_vcdsrc_setup_interfaces); +static void gst_vcdsrc_finalize (GObject * object); + static void gst_vcdsrc_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_vcdsrc_get_property (GObject * object, guint prop_id, @@ -116,6 +118,7 @@ gst_vcdsrc_class_init (GstVCDSrcClass * klass) gobject_class->set_property = gst_vcdsrc_set_property; gobject_class->get_property = gst_vcdsrc_get_property; + gobject_class->finalize = gst_vcdsrc_finalize; g_object_class_install_property (gobject_class, PROP_DEVICE, g_param_spec_string ("device", "Device", @@ -149,6 +152,16 @@ gst_vcdsrc_init (GstVCDSrc * vcdsrc, GstVCDSrcClass * klass) vcdsrc->max_errors = 16; } +static void +gst_vcdsrc_finalize (GObject * object) +{ + GstVCDSrc *vcdsrc = GST_VCDSRC (object); + + g_free (vcdsrc->device); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + static inline guint64 gst_vcdsrc_msf (GstVCDSrc * vcdsrc, gint track) -- cgit v1.2.1