From 89bbfdc3683c00f14cf7142cd19faadaf2ccc1c8 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Sat, 6 Mar 2004 20:56:27 +0000 Subject: [PATCH] Fix several misuse of gst_buffer_merge (it doesn't take ownership of any buffer), should fix some leaks. I hope I did... Original commit message from CVS: 2004-03-06 Christophe Fergeau * ext/faac/gstfaac.c: (gst_faac_chain): * ext/flac/gstflactag.c: (gst_flac_tag_chain): * ext/libpng/gstpngenc.c: (user_write_data): * ext/mikmod/gstmikmod.c: (gst_mikmod_loop): * gst/ac3parse/gstac3parse.c: (gst_ac3parse_chain): * gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_chain_subtitle): * gst/mpegstream/gstrfc2250enc.c: (gst_rfc2250_enc_add_slice): Fix several misuse of gst_buffer_merge (it doesn't take ownership of any buffer), should fix some leaks. I hope I didn't unref buffers that shouldn't be... --- ChangeLog | 13 +++++++++++++ ext/flac/gstflactag.c | 12 ++++++++++-- ext/libpng/gstpngenc.c | 5 ++++- ext/mikmod/gstmikmod.c | 7 +++++-- 4 files changed, 32 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index c23146f7a8..9e1a5c621a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-03-06 Christophe Fergeau + + * ext/faac/gstfaac.c: (gst_faac_chain): + * ext/flac/gstflactag.c: (gst_flac_tag_chain): + * ext/libpng/gstpngenc.c: (user_write_data): + * ext/mikmod/gstmikmod.c: (gst_mikmod_loop): + * gst/ac3parse/gstac3parse.c: (gst_ac3parse_chain): + * gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_chain_subtitle): + * gst/mpegstream/gstrfc2250enc.c: (gst_rfc2250_enc_add_slice): + Fix several misuse of gst_buffer_merge (it doesn't take ownership + of any buffer), should fix some leaks. I hope I didn't unref buffers + that shouldn't be... + 2004-03-06 Thomas Vander Stichele * gst-libs/gst/media-info/media-info-priv.c: (have_type_callback), diff --git a/ext/flac/gstflactag.c b/ext/flac/gstflactag.c index f2d178d0df..5d1c56c2eb 100644 --- a/ext/flac/gstflactag.c +++ b/ext/flac/gstflactag.c @@ -264,7 +264,11 @@ gst_flac_tag_chain (GstPad *pad, GstData *data) tag = GST_FLAC_TAG (gst_pad_get_parent (pad)); if (tag->buffer) { - tag->buffer = gst_buffer_merge (tag->buffer, buffer); + GstBuffer *merge; + merge = gst_buffer_merge (tag->buffer, buffer); + gst_buffer_unref (buffer); + gst_buffer_unref (tag->buffer); + tag->buffer = merge; } else { tag->buffer = buffer; } @@ -365,7 +369,11 @@ gst_flac_tag_chain (GstPad *pad, GstData *data) if (tag->vorbiscomment == NULL) { tag->vorbiscomment = sub; } else { - tag->vorbiscomment = gst_buffer_merge (tag->vorbiscomment, sub); + GstBuffer *merge; + merge = gst_buffer_merge (tag->vorbiscomment, sub); + gst_buffer_unref (tag->vorbiscomment); + gst_buffer_unref (sub); + tag->vorbiscomment = merge; } } diff --git a/ext/libpng/gstpngenc.c b/ext/libpng/gstpngenc.c index 8af25d3852..393e642cb6 100644 --- a/ext/libpng/gstpngenc.c +++ b/ext/libpng/gstpngenc.c @@ -207,8 +207,11 @@ void user_write_data (png_structp png_ptr, png_bytep data, png_uint_32 length) if (pngenc->buffer_out) { - pngenc->buffer_out = gst_buffer_merge (pngenc->buffer_out, buffer); + GstBuffer *merge; + merge = gst_buffer_merge (pngenc->buffer_out, buffer); gst_buffer_unref (buffer); + gst_buffer_unref (pngenc->buffer_out); + pngenc->buffer_out = merge; } else pngenc->buffer_out = buffer; diff --git a/ext/mikmod/gstmikmod.c b/ext/mikmod/gstmikmod.c index c777ef464d..cec788d5d1 100644 --- a/ext/mikmod/gstmikmod.c +++ b/ext/mikmod/gstmikmod.c @@ -298,8 +298,11 @@ gst_mikmod_loop (GstElement *element) else { if ( mikmod->Buffer ) { - mikmod->Buffer = gst_buffer_merge( mikmod->Buffer, buffer_in ); - gst_buffer_unref( buffer_in ); + GstBuffer *merge; + merge = gst_buffer_merge( mikmod->Buffer, buffer_in ); + gst_buffer_unref( buffer_in ); + gst_buffer_unref( mikmod->Buffer ); + mikmod->Buffer = merge; } else mikmod->Buffer = buffer_in;