diff options
author | Wim Taymans <wim.taymans@gmail.com> | 2006-03-13 15:49:08 +0000 |
---|---|---|
committer | Wim Taymans <wim.taymans@gmail.com> | 2006-03-13 15:49:08 +0000 |
commit | 8a51401ef61672335deec8d55dfd421c06887783 (patch) | |
tree | 37e2f96f15d4238ff7126c968e91d20a2dd9b344 /ext | |
parent | b6fc5016695a8234ff2deb78bfa8addd0e8631f4 (diff) |
close #333784 unref the result of gst_pad_get_parent() by: Christophe Fergeau.
Original commit message from CVS:
* ext/cairo/gsttextoverlay.c: (gst_text_overlay_setcaps):
* ext/esd/esdmon.c: (gst_esdmon_get):
* ext/flac/gstflactag.c: (gst_flac_tag_chain):
* ext/gdk_pixbuf/gstgdkpixbuf.c: (gst_gdk_pixbuf_sink_setcaps),
(gst_gdk_pixbuf_sink_getcaps):
* ext/jpeg/gstjpegenc.c: (gst_jpegenc_getcaps),
(gst_jpegenc_setcaps):
* ext/jpeg/gstsmokedec.c: (gst_smokedec_chain):
* ext/jpeg/gstsmokeenc.c: (gst_smokeenc_getcaps),
(gst_smokeenc_setcaps):
* ext/libmng/gstmngdec.c: (gst_mngdec_sinklink),
(gst_mngdec_src_getcaps):
* ext/libmng/gstmngenc.c: (gst_mngenc_sinklink),
(gst_mngenc_chain):
* ext/libpng/gstpngenc.c: (gst_pngenc_setcaps):
* ext/mikmod/gstmikmod.c: (gst_mikmod_srclink):
* ext/speex/gstspeexdec.c: (speex_dec_convert),
(speex_dec_src_event), (speex_dec_chain):
* gst/avi/gstavimux.c: (gst_avimux_vidsinkconnect),
(gst_avimux_audsinkconnect), (gst_avimux_handle_event):
* gst/debug/negotiation.c: (gst_negotiation_getcaps),
(gst_negotiation_pad_link), (gst_negotiation_chain):
* gst/flx/gstflxdec.c: (gst_flxdec_src_query_handler),
(gst_flxdec_chain):
* gst/interleave/deinterleave.c: (deinterleave_sink_link),
(deinterleave_chain):
* gst/law/mulaw-encode.c: (mulawenc_setcaps):
* gst/median/gstmedian.c: (gst_median_link):
* gst/monoscope/gstmonoscope.c: (gst_monoscope_srcconnect),
(gst_monoscope_chain):
* gst/rtp/gstrtpL16pay.c: (gst_rtpL16pay_sinkconnect):
* gst/wavenc/gstwavenc.c: (gst_wavenc_sink_setcaps):
* sys/osxaudio/gstosxaudiosink.c: (gst_osxaudiosink_chain):
* sys/osxaudio/gstosxaudiosrc.c: (gst_osxaudiosrc_get):
close #333784 unref the result of gst_pad_get_parent()
by: Christophe Fergeau.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/cairo/gsttextoverlay.c | 2 | ||||
-rw-r--r-- | ext/esd/esdmon.c | 1 | ||||
-rw-r--r-- | ext/flac/gstflactag.c | 18 | ||||
-rw-r--r-- | ext/gdk_pixbuf/gstgdkpixbuf.c | 3 | ||||
-rw-r--r-- | ext/jpeg/gstjpegenc.c | 3 | ||||
-rw-r--r-- | ext/jpeg/gstsmokedec.c | 3 | ||||
-rw-r--r-- | ext/jpeg/gstsmokeenc.c | 4 | ||||
-rw-r--r-- | ext/libmng/gstmngdec.c | 3 | ||||
-rw-r--r-- | ext/libmng/gstmngenc.c | 7 | ||||
-rw-r--r-- | ext/libpng/gstpngenc.c | 3 | ||||
-rw-r--r-- | ext/mikmod/gstmikmod.c | 10 | ||||
-rw-r--r-- | ext/speex/gstspeexdec.c | 35 |
12 files changed, 71 insertions, 21 deletions
diff --git a/ext/cairo/gsttextoverlay.c b/ext/cairo/gsttextoverlay.c index 2fd8dc85..34137ad9 100644 --- a/ext/cairo/gsttextoverlay.c +++ b/ext/cairo/gsttextoverlay.c @@ -556,6 +556,8 @@ gst_text_overlay_setcaps (GstPad * pad, GstCaps * caps) overlay->fps_n = gst_value_get_fraction_numerator (fps); overlay->fps_d = gst_value_get_fraction_denominator (fps); + gst_object_unref (overlay); + return ret; } diff --git a/ext/esd/esdmon.c b/ext/esd/esdmon.c index 58111057..f69e0cad 100644 --- a/ext/esd/esdmon.c +++ b/ext/esd/esdmon.c @@ -277,6 +277,7 @@ gst_esdmon_get (GstPad * pad) GST_DEBUG ("pushed buffer from esdmon of %ld bytes, timestamp %" G_GINT64_FORMAT, readbytes, GST_BUFFER_TIMESTAMP (buf)); + gst_object_unref (esdmon); return GST_DATA (buf); } diff --git a/ext/flac/gstflactag.c b/ext/flac/gstflactag.c index ffb435d2..c3f23705 100644 --- a/ext/flac/gstflactag.c +++ b/ext/flac/gstflactag.c @@ -289,11 +289,11 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) /* Initial state, we don't even know if we are dealing with a flac file */ if (tag->state == GST_FLAC_TAG_STATE_INIT) { if (!caps_nego (tag)) { - return; + goto cleanup; } if (GST_BUFFER_SIZE (tag->buffer) < sizeof (FLAC_MAGIC)) { - return; + goto cleanup; } if (strncmp (GST_BUFFER_DATA (tag->buffer), FLAC_MAGIC, @@ -337,7 +337,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) * 24 next bits: size of the metadata to follow (big endian) */ if (GST_BUFFER_SIZE (tag->buffer) < 4) { - return; + goto cleanup; } is_last = (((GST_BUFFER_DATA (tag->buffer)[0]) & 0x80) == 0x80); /* If we have metadata set on the element, the last metadata block @@ -443,7 +443,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) if (tag->only_output_tags) { send_eos (tag); - return; + goto cleanup; } } @@ -456,7 +456,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) * metadata, so just stop now */ send_eos (tag); - return; + goto cleanup; } else { tag->state = GST_FLAC_TAG_STATE_ADD_VORBIS_COMMENT; } @@ -507,7 +507,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) if (buffer == NULL) { GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL), ("Error converting tag list to vorbiscomment buffer")); - return; + goto cleanup; } size = GST_BUFFER_SIZE (buffer) - 4; if ((size > 0xFFFFFF) || (size < 0)) { @@ -517,7 +517,7 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) */ GST_ELEMENT_ERROR (tag, CORE, TAG, (NULL), ("Vorbis comment of size %d too long", size)); - return; + goto cleanup; } /* Get rid of the framing bit at the end of the vorbiscomment buffer @@ -545,12 +545,14 @@ gst_flac_tag_chain (GstPad * pad, GstData * data) tag->state = GST_FLAC_TAG_STATE_AUDIO_DATA; } - /* The metadata blocks have been read, now we are reading audio data */ if (tag->state == GST_FLAC_TAG_STATE_AUDIO_DATA) { gst_pad_push (tag->srcpad, GST_DATA (tag->buffer)); tag->buffer = NULL; } + +cleanup: + gst_object_unref (tag); } diff --git a/ext/gdk_pixbuf/gstgdkpixbuf.c b/ext/gdk_pixbuf/gstgdkpixbuf.c index 34dcae94..3ddf1d2e 100644 --- a/ext/gdk_pixbuf/gstgdkpixbuf.c +++ b/ext/gdk_pixbuf/gstgdkpixbuf.c @@ -126,7 +126,7 @@ GST_BOILERPLATE (GstGdkPixbuf, gst_gdk_pixbuf, GstElement, GST_TYPE_ELEMENT) GST_DEBUG ("got framerate of %d/%d fps => packetized mode", filter->framerate_numerator, filter->framerate_denominator); } - + gst_object_unref (filter); return TRUE; } @@ -184,6 +184,7 @@ gst_gdk_pixbuf_sink_getcaps (GstPad * pad) filter = GST_GDK_PIXBUF (gst_pad_get_parent (pad)); g_return_val_if_fail (filter != NULL, NULL); g_return_val_if_fail (GST_IS_GDK_PIXBUF (filter), NULL); + gst_object_unref (filter); return gst_gdk_pixbuf_get_capslist (); } diff --git a/ext/jpeg/gstjpegenc.c b/ext/jpeg/gstjpegenc.c index 2485d2f6..b76b6205 100644 --- a/ext/jpeg/gstjpegenc.c +++ b/ext/jpeg/gstjpegenc.c @@ -280,6 +280,7 @@ gst_jpegenc_getcaps (GstPad * pad) GST_STR_FOURCC ("I420"), NULL); } } + gst_object_unref (jpegenc); return caps; } @@ -322,6 +323,8 @@ gst_jpegenc_setcaps (GstPad * pad, GstCaps * caps) gst_jpegenc_resync (jpegenc); } + gst_object_unref (jpegenc); + return ret; } diff --git a/ext/jpeg/gstsmokedec.c b/ext/jpeg/gstsmokedec.c index 88fa726f..72ed8fe0 100644 --- a/ext/jpeg/gstsmokedec.c +++ b/ext/jpeg/gstsmokedec.c @@ -183,7 +183,8 @@ gst_smokedec_chain (GstPad * pad, GstBuffer * buf) if (smokeret != SMOKECODEC_OK) goto header_error; - return GST_FLOW_OK; + ret = GST_FLOW_OK; + goto done; } /* now handle data packets */ diff --git a/ext/jpeg/gstsmokeenc.c b/ext/jpeg/gstsmokeenc.c index 392f0a88..cd499f85 100644 --- a/ext/jpeg/gstsmokeenc.c +++ b/ext/jpeg/gstsmokeenc.c @@ -228,6 +228,8 @@ gst_smokeenc_getcaps (GstPad * pad) } } + gst_object_unref (smokeenc); + return caps; } @@ -270,6 +272,8 @@ gst_smokeenc_setcaps (GstPad * pad, GstCaps * caps) gst_smokeenc_resync (smokeenc); } + gst_object_unref (smokeenc); + return ret; } diff --git a/ext/libmng/gstmngdec.c b/ext/libmng/gstmngdec.c index bd223a4d..dab5c044 100644 --- a/ext/libmng/gstmngdec.c +++ b/ext/libmng/gstmngdec.c @@ -141,6 +141,7 @@ gst_mngdec_sinklink (GstPad * pad, const GstCaps * caps) structure = gst_caps_get_structure (caps, 0); gst_structure_get_double (structure, "framerate", &mngdec->fps); + gst_object_unref (mngdec); return TRUE; } @@ -227,6 +228,8 @@ gst_mngdec_src_getcaps (GstPad * pad) } } + gst_object_unref (mngdec); + return caps; } diff --git a/ext/libmng/gstmngenc.c b/ext/libmng/gstmngenc.c index d52f6a40..320d314e 100644 --- a/ext/libmng/gstmngenc.c +++ b/ext/libmng/gstmngenc.c @@ -158,6 +158,7 @@ gst_mngenc_sinklink (GstPad * pad, const GstCaps * caps) GstMngEnc *mngenc; gdouble fps; GstStructure *structure; + GstPadLinkReturn result; mngenc = GST_MNGENC (gst_pad_get_parent (pad)); @@ -172,7 +173,10 @@ gst_mngenc_sinklink (GstPad * pad, const GstCaps * caps) "width", G_TYPE_INT, mngenc->width, "height", G_TYPE_INT, mngenc->height, NULL); - return gst_pad_try_set_caps (mngenc->srcpad, caps); + result = gst_pad_try_set_caps (mngenc->srcpad, caps); + gst_object_unref (mngenc); + + return result; } static void @@ -202,6 +206,7 @@ gst_mngenc_chain (GstPad * pad, GstData * _data) /* FIXME, do something here */ gst_buffer_unref (buf); + gst_object_unref (mngenc); } diff --git a/ext/libpng/gstpngenc.c b/ext/libpng/gstpngenc.c index 190ffbb3..f52e57b4 100644 --- a/ext/libpng/gstpngenc.c +++ b/ext/libpng/gstpngenc.c @@ -176,6 +176,9 @@ gst_pngenc_setcaps (GstPad * pad, GstCaps * caps) gst_caps_unref (pcaps); gst_object_unref (opeer); } + + gst_object_unref (pngenc); + return ret; } diff --git a/ext/mikmod/gstmikmod.c b/ext/mikmod/gstmikmod.c index db83dc46..4226467f 100644 --- a/ext/mikmod/gstmikmod.c +++ b/ext/mikmod/gstmikmod.c @@ -269,6 +269,7 @@ gst_mikmod_srclink (GstPad * pad, const GstCaps * caps) GstStructure *structure; gint depth; gint channels; + gboolean result; filter = GST_MIKMOD (gst_pad_get_parent (pad)); @@ -280,7 +281,14 @@ gst_mikmod_srclink (GstPad * pad, const GstCaps * caps) filter->stereo = (channels == 2); gst_structure_get_int (structure, "rate", &filter->mixfreq); - return gst_mikmod_setup (filter) ? GST_PAD_LINK_OK : GST_PAD_LINK_REFUSED; + result = gst_mikmod_setup (filter); + gst_object_unref (filter); + + if (result) { + return GST_PAD_LINK_OK; + } else { + return GST_PAD_LINK_REFUSED; + } } static void diff --git a/ext/speex/gstspeexdec.c b/ext/speex/gstspeexdec.c index 5bf95818..d213f9b3 100644 --- a/ext/speex/gstspeexdec.c +++ b/ext/speex/gstspeexdec.c @@ -158,12 +158,16 @@ speex_dec_convert (GstPad * pad, dec = GST_SPEEXDEC (gst_pad_get_parent (pad)); - if (dec->packetno < 1) - return FALSE; + if (dec->packetno < 1) { + res = FALSE; + goto cleanup; + } if (pad == dec->sinkpad && - (src_format == GST_FORMAT_BYTES || *dest_format == GST_FORMAT_BYTES)) - return FALSE; + (src_format == GST_FORMAT_BYTES || *dest_format == GST_FORMAT_BYTES)) { + res = FALSE; + goto cleanup; + } switch (src_format) { case GST_FORMAT_TIME: @@ -206,6 +210,8 @@ speex_dec_convert (GstPad * pad, res = FALSE; } +cleanup: + gst_object_unref (dec); return res; } @@ -289,6 +295,8 @@ speex_dec_src_event (GstPad * pad, GstEvent * event) break; } + gst_object_unref (dec); + return res; } @@ -350,6 +358,7 @@ speex_dec_chain (GstPad * pad, GstBuffer * buf) { GstFlowReturn res; GstSpeexDec *dec; + GstFlowReturn result; dec = GST_SPEEXDEC (gst_pad_get_parent (pad)); @@ -363,14 +372,16 @@ speex_dec_chain (GstPad * pad, GstBuffer * buf) if (!dec->header) { GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, (NULL), ("couldn't read header")); - return GST_FLOW_ERROR; + result = GST_FLOW_ERROR; + goto cleanup; } if (dec->header->mode >= SPEEX_NB_MODES) { GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, (NULL), ("Mode number %d does not (yet/any longer) exist in this version", dec->header->mode)); - return GST_FLOW_ERROR; + result = GST_FLOW_ERROR; + goto cleanup; } dec->mode = (SpeexMode *) speex_mode_list[dec->header->mode]; @@ -381,7 +392,8 @@ speex_dec_chain (GstPad * pad, GstBuffer * buf) GST_ELEMENT_ERROR (GST_ELEMENT (dec), STREAM, DECODE, (NULL), ("couldn't initialize decoder")); gst_buffer_unref (buf); - return GST_FLOW_ERROR; + result = GST_FLOW_ERROR; + goto cleanup; } speex_decoder_ctl (dec->state, SPEEX_SET_ENH, &dec->enh); @@ -408,7 +420,8 @@ speex_dec_chain (GstPad * pad, GstBuffer * buf) if (!gst_pad_set_caps (dec->srcpad, caps)) { gst_caps_unref (caps); - return GST_FLOW_NOT_NEGOTIATED; + result = GST_FLOW_NOT_NEGOTIATED; + goto cleanup; } gst_caps_unref (caps); gst_pad_push_event (dec->srcpad, @@ -511,8 +524,12 @@ speex_dec_chain (GstPad * pad, GstBuffer * buf) } } dec->packetno++; + result = GST_FLOW_OK; + +cleanup: + gst_object_unref (dec); - return GST_FLOW_OK; + return result; } static void |