diff --git a/ext/cog/gstcogmse.c b/ext/cog/gstcogmse.c index 8eb63bec38..3ce16a37b7 100644 --- a/ext/cog/gstcogmse.c +++ b/ext/cog/gstcogmse.c @@ -203,6 +203,9 @@ gst_mse_finalize (GObject * object) { GstMSE *fs = GST_MSE (object); + gst_object_unref (fs->srcpad); + gst_object_unref (fs->sinkpad_ref); + gst_object_unref (fs->sinkpad_test); g_mutex_free (fs->lock); g_cond_free (fs->cond); } diff --git a/ext/modplug/gstmodplug.cc b/ext/modplug/gstmodplug.cc index 75988fd759..b7fc4b2a72 100644 --- a/ext/modplug/gstmodplug.cc +++ b/ext/modplug/gstmodplug.cc @@ -491,7 +491,6 @@ gst_modplug_load_song (GstModPlug * modplug) gst_caps_copy_nth (gst_pad_get_pad_template_caps (modplug->srcpad), 0); } gst_pad_fixate_caps (modplug->srcpad, newcaps); - gst_pad_set_caps (modplug->srcpad, newcaps); /* set up modplug to output the negotiated format */ structure = gst_caps_get_structure (newcaps, 0); @@ -499,6 +498,9 @@ gst_modplug_load_song (GstModPlug * modplug) gst_structure_get_int (structure, "channels", &modplug->channel); gst_structure_get_int (structure, "rate", &modplug->frequency); + gst_pad_set_caps (modplug->srcpad, newcaps); + gst_caps_unref (newcaps); + modplug->read_samples = 1152; modplug->read_bytes = modplug->read_samples * modplug->channel * modplug->bits / 8; diff --git a/ext/opus/gstopusparse.c b/ext/opus/gstopusparse.c index 05963ca791..9bb2c2216f 100644 --- a/ext/opus/gstopusparse.c +++ b/ext/opus/gstopusparse.c @@ -126,6 +126,7 @@ gst_opus_parse_stop (GstBaseParse * base) GstOpusParse *parse = GST_OPUS_PARSE (base); g_slist_foreach (parse->headers, (GFunc) gst_buffer_unref, NULL); + g_slist_free (parse->headers); parse->headers = NULL; parse->header_sent = FALSE; @@ -301,6 +302,7 @@ gst_opus_parse_parse_frame (GstBaseParse * base, GstBaseParseFrame * frame) } g_slist_foreach (parse->headers, (GFunc) gst_buffer_unref, NULL); + g_slist_free (parse->headers); parse->headers = NULL; if (parse->id_header && parse->comment_header) { @@ -322,6 +324,7 @@ gst_opus_parse_parse_frame (GstBaseParse * base, GstBaseParseFrame * frame) gst_buffer_replace (&parse->comment_header, NULL); gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (parse), caps); + gst_caps_unref (caps); parse->header_sent = TRUE; } diff --git a/ext/schroedinger/gstschrodec.c b/ext/schroedinger/gstschrodec.c index 126ef1fed4..50bb40480b 100644 --- a/ext/schroedinger/gstschrodec.c +++ b/ext/schroedinger/gstschrodec.c @@ -55,7 +55,7 @@ struct _GstSchroDec SchroDecoder *decoder; - GstBuffer *seq_header_buffer; + gboolean seq_header_buffer_seen; }; struct _GstSchroDecClass @@ -308,8 +308,7 @@ parse_sequence_header (GstSchroDec * schro_dec, guint8 * data, int size) state = gst_base_video_decoder_get_state (GST_BASE_VIDEO_DECODER (schro_dec)); - schro_dec->seq_header_buffer = gst_buffer_new_and_alloc (size); - memcpy (GST_BUFFER_DATA (schro_dec->seq_header_buffer), data, size); + schro_dec->seq_header_buffer_seen = TRUE; ret = schro_parse_decode_sequence_header (data + 13, size - 13, &video_format); @@ -462,7 +461,7 @@ gst_schro_dec_parse_data (GstBaseVideoDecoder * base_video_decoder, g_free (data); } - if (schro_decoder->seq_header_buffer == NULL) { + if (!schro_decoder->seq_header_buffer_seen) { gst_adapter_flush (base_video_decoder->input_adapter, next); return GST_FLOW_OK; } @@ -572,6 +571,8 @@ gst_schro_dec_process (GstSchroDec * schro_dec, gboolean eos) schro_frame_unref (schro_frame); } + if (tag) + schro_tag_free (tag); if (!eos) { go = FALSE; } diff --git a/ext/schroedinger/gstschroenc.c b/ext/schroedinger/gstschroenc.c index beda4eac96..c2064d3caf 100644 --- a/ext/schroedinger/gstschroenc.c +++ b/ext/schroedinger/gstschroenc.c @@ -101,6 +101,7 @@ static GstFlowReturn gst_schro_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder, GstVideoFrame * frame); static GstFlowReturn gst_schro_enc_shape_output (GstBaseVideoEncoder * base_video_encoder, GstVideoFrame * frame); +static void gst_schro_enc_finalize (GObject * object); static GstStaticPadTemplate gst_schro_enc_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", @@ -172,6 +173,7 @@ gst_schro_enc_class_init (GstSchroEncClass * klass) gobject_class->set_property = gst_schro_enc_set_property; gobject_class->get_property = gst_schro_enc_get_property; + gobject_class->finalize = gst_schro_enc_finalize; for (i = 0; i < schro_encoder_get_n_settings (); i++) { const SchroEncoderSetting *setting; @@ -231,7 +233,22 @@ gst_schro_enc_init (GstSchroEnc * schro_enc, GstSchroEncClass * klass) schro_enc->video_format = schro_encoder_get_video_format (schro_enc->encoder); } +static void +gst_schro_enc_finalize (GObject * object) +{ + GstSchroEnc *schro_enc = GST_SCHRO_ENC (object); + if (schro_enc->encoder) { + schro_encoder_free (schro_enc->encoder); + schro_enc->encoder = NULL; + } + if (schro_enc->video_format) { + g_free (schro_enc->video_format); + schro_enc->video_format = NULL; + } + + G_OBJECT_CLASS (parent_class)->finalize (object); +} static gboolean gst_schro_enc_set_format (GstBaseVideoEncoder * base_video_encoder, @@ -423,17 +440,6 @@ gst_schro_enc_start (GstBaseVideoEncoder * base_video_encoder) static gboolean gst_schro_enc_stop (GstBaseVideoEncoder * base_video_encoder) { - GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder); - - if (schro_enc->encoder) { - schro_encoder_free (schro_enc->encoder); - schro_enc->encoder = NULL; - } - if (schro_enc->video_format) { - g_free (schro_enc->video_format); - schro_enc->video_format = NULL; - } - return TRUE; } diff --git a/gst-libs/gst/codecparsers/gstmpegvideoparser.c b/gst-libs/gst/codecparsers/gstmpegvideoparser.c index 009c02bd19..b725d9d353 100644 --- a/gst-libs/gst/codecparsers/gstmpegvideoparser.c +++ b/gst-libs/gst/codecparsers/gstmpegvideoparser.c @@ -332,8 +332,10 @@ gst_mpeg_video_parse (const guint8 * data, gsize size, guint offset) codoffsize->offset = gst_byte_reader_get_pos (&br) + offset; rsize = gst_byte_reader_get_remaining (&br); - if (rsize <= 0) + if (rsize <= 0) { + g_free (codoffsize); break; + } off = scan_for_start_codes (&br, 0, rsize); diff --git a/gst/dccp/gstdccpclientsink.c b/gst/dccp/gstdccpclientsink.c index a890dcb719..a3bded08b1 100644 --- a/gst/dccp/gstdccpclientsink.c +++ b/gst/dccp/gstdccpclientsink.c @@ -73,6 +73,7 @@ static gboolean gst_dccp_client_sink_stop (GstBaseSink * bsink); static gboolean gst_dccp_client_sink_start (GstBaseSink * bsink); static GstFlowReturn gst_dccp_client_sink_render (GstBaseSink * bsink, GstBuffer * buf); +static void gst_dccp_client_sink_finalize (GObject * gobject); GST_DEBUG_CATEGORY_STATIC (dccpclientsink_debug); @@ -167,6 +168,16 @@ gst_dccp_client_sink_get_property (GObject * object, guint prop_id, } } +static void +gst_dccp_client_sink_finalize (GObject * gobject) +{ + GstDCCPClientSink *this = GST_DCCP_CLIENT_SINK (gobject); + + g_free (this->host); + + G_OBJECT_CLASS (parent_class)->finalize (gobject); +} + /* * Starts the element. If the sockfd property was not the default, this method * will create a new socket and connect to the server. @@ -276,6 +287,7 @@ gst_dccp_client_sink_class_init (GstDCCPClientSinkClass * klass) gobject_class->set_property = gst_dccp_client_sink_set_property; gobject_class->get_property = gst_dccp_client_sink_get_property; + gobject_class->finalize = gst_dccp_client_sink_finalize; g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_PORT, g_param_spec_int ("port", "Port", diff --git a/gst/hls/gsthlsdemux.c b/gst/hls/gsthlsdemux.c index 504df27fc0..7a7d5f6698 100644 --- a/gst/hls/gsthlsdemux.c +++ b/gst/hls/gsthlsdemux.c @@ -166,6 +166,7 @@ gst_hls_demux_dispose (GObject * obj) gst_hls_demux_reset (demux, TRUE); + g_queue_free (demux->queue); gst_object_unref (demux->download); G_OBJECT_CLASS (parent_class)->dispose (obj); diff --git a/gst/inter/gstinteraudiosink.c b/gst/inter/gstinteraudiosink.c index d5eb98b0f5..1309fbc9ee 100644 --- a/gst/inter/gstinteraudiosink.c +++ b/gst/inter/gstinteraudiosink.c @@ -156,11 +156,6 @@ static void gst_inter_audio_sink_init (GstInterAudioSink * interaudiosink, GstInterAudioSinkClass * interaudiosink_class) { - - interaudiosink->sinkpad = - gst_pad_new_from_static_template (&gst_inter_audio_sink_sink_template, - "sink"); - interaudiosink->surface = gst_inter_surface_get ("default"); } diff --git a/gst/inter/gstinteraudiosink.h b/gst/inter/gstinteraudiosink.h index 53597e7c9b..b0a32769ec 100644 --- a/gst/inter/gstinteraudiosink.h +++ b/gst/inter/gstinteraudiosink.h @@ -40,8 +40,6 @@ struct _GstInterAudioSink GstInterSurface *surface; - GstPad *sinkpad; - int fps_n; int fps_d; }; diff --git a/gst/inter/gstinteraudiosrc.c b/gst/inter/gstinteraudiosrc.c index df7c16f70d..11b8839e15 100644 --- a/gst/inter/gstinteraudiosrc.c +++ b/gst/inter/gstinteraudiosrc.c @@ -166,10 +166,6 @@ gst_inter_audio_src_init (GstInterAudioSrc * interaudiosrc, GstInterAudioSrcClass * interaudiosrc_class) { - interaudiosrc->srcpad = - gst_pad_new_from_static_template (&gst_inter_audio_src_src_template, - "src"); - gst_base_src_set_live (GST_BASE_SRC (interaudiosrc), TRUE); gst_base_src_set_blocksize (GST_BASE_SRC (interaudiosrc), -1); diff --git a/gst/inter/gstinteraudiosrc.h b/gst/inter/gstinteraudiosrc.h index cac928f702..958a1a53d9 100644 --- a/gst/inter/gstinteraudiosrc.h +++ b/gst/inter/gstinteraudiosrc.h @@ -38,7 +38,6 @@ struct _GstInterAudioSrc { GstBaseSrc base_interaudiosrc; - GstPad *srcpad; GstInterSurface *surface; guint64 n_samples; diff --git a/gst/inter/gstintervideosink.c b/gst/inter/gstintervideosink.c index 940d7b27e7..9e1d782e54 100644 --- a/gst/inter/gstintervideosink.c +++ b/gst/inter/gstintervideosink.c @@ -150,11 +150,6 @@ static void gst_inter_video_sink_init (GstInterVideoSink * intervideosink, GstInterVideoSinkClass * intervideosink_class) { - - intervideosink->sinkpad = - gst_pad_new_from_static_template (&gst_inter_video_sink_sink_template, - "sink"); - intervideosink->surface = gst_inter_surface_get ("default"); } diff --git a/gst/inter/gstintervideosink.h b/gst/inter/gstintervideosink.h index 00bbd6e857..5b02efe62d 100644 --- a/gst/inter/gstintervideosink.h +++ b/gst/inter/gstintervideosink.h @@ -40,8 +40,6 @@ struct _GstInterVideoSink GstInterSurface *surface; - GstPad *sinkpad; - int fps_n; int fps_d; }; diff --git a/gst/inter/gstintervideosrc.c b/gst/inter/gstintervideosrc.c index 04d9655305..69214d7bf4 100644 --- a/gst/inter/gstintervideosrc.c +++ b/gst/inter/gstintervideosrc.c @@ -163,11 +163,6 @@ static void gst_inter_video_src_init (GstInterVideoSrc * intervideosrc, GstInterVideoSrcClass * intervideosrc_class) { - - intervideosrc->srcpad = - gst_pad_new_from_static_template (&gst_inter_video_src_src_template, - "src"); - gst_base_src_set_format (GST_BASE_SRC (intervideosrc), GST_FORMAT_TIME); gst_base_src_set_live (GST_BASE_SRC (intervideosrc), TRUE); diff --git a/gst/inter/gstintervideosrc.h b/gst/inter/gstintervideosrc.h index 909410a186..e7a3cd045d 100644 --- a/gst/inter/gstintervideosrc.h +++ b/gst/inter/gstintervideosrc.h @@ -39,7 +39,6 @@ struct _GstInterVideoSrc { GstBaseSrc base_intervideosrc; - GstPad *srcpad; GstInterSurface *surface; GstVideoFormat format; diff --git a/gst/patchdetect/gstpatchdetect.c b/gst/patchdetect/gstpatchdetect.c index af4d88319a..bb1d6f8b3d 100644 --- a/gst/patchdetect/gstpatchdetect.c +++ b/gst/patchdetect/gstpatchdetect.c @@ -147,12 +147,6 @@ static void gst_patchdetect_init (GstPatchdetect * patchdetect, GstPatchdetectClass * patchdetect_class) { - - patchdetect->sinkpad = - gst_pad_new_from_static_template (&gst_patchdetect_sink_template, "sink"); - - patchdetect->srcpad = - gst_pad_new_from_static_template (&gst_patchdetect_src_template, "src"); } void diff --git a/gst/patchdetect/gstpatchdetect.h b/gst/patchdetect/gstpatchdetect.h index 1f29218aa8..acf23e0762 100644 --- a/gst/patchdetect/gstpatchdetect.h +++ b/gst/patchdetect/gstpatchdetect.h @@ -37,9 +37,6 @@ struct _GstPatchdetect { GstBaseTransform base_patchdetect; - GstPad *sinkpad; - GstPad *srcpad; - GstVideoFormat format; int width; int height; diff --git a/gst/y4m/gsty4mdec.c b/gst/y4m/gsty4mdec.c index 277bb1ffee..d61c4b3ad5 100644 --- a/gst/y4m/gsty4mdec.c +++ b/gst/y4m/gsty4mdec.c @@ -586,6 +586,9 @@ gst_y4m_dec_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) } res = TRUE; + /* not sure why it's not forwarded, but let's unref it so it + doesn't leak, remove the unref if it gets forwarded again */ + gst_event_unref (event); //res = gst_pad_push_event (y4mdec->srcpad, event); } break; diff --git a/tests/check/elements/opus.c b/tests/check/elements/opus.c index 66c12a3237..d18f6230fe 100644 --- a/tests/check/elements/opus.c +++ b/tests/check/elements/opus.c @@ -110,7 +110,7 @@ cleanup_opusenc (GstElement * opusenc) } static void -check_buffers (guint expected, gboolean headers_in_caps) +check_buffers (guint expected) { GstBuffer *outbuffer; guint i, num_buffers; @@ -152,7 +152,7 @@ GST_START_TEST (test_opus_id_header) /* ... and nothing ends up on the global buffer list */ ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); gst_buffer_unref (inbuffer); - fail_unless (g_list_length (buffers) == 0); + check_buffers (0); /* cleanup */ cleanup_opusdec (opusdec); @@ -248,7 +248,7 @@ GST_START_TEST (test_opus_encode_samples) "could not set to ready"); /* default frame size is 20 ms, at 48000 Hz that's 960 samples */ - check_buffers ((nsamples + 959) / 960, FALSE); + check_buffers ((nsamples + 959) / 960); /* cleanup */ cleanup_opusenc (opusenc); @@ -331,6 +331,8 @@ GST_START_TEST (test_opus_encode_properties) /* change random parameters */ g_object_set (opusenc, param_changes[step].param, param_changes[step].value, NULL); + + check_buffers (1); } gst_caps_unref (caps);