summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <teuf@gnome.org>2004-03-06 20:56:28 +0000
committerChristophe Fergeau <teuf@gnome.org>2004-03-06 20:56:28 +0000
commitf8781e3de80c7602f854e98d16ba72e7427e8887 (patch)
tree9c9434f16d84685c87595b84152d5886d58c3ddd
parenta11cf2ec0a951b954857ebfa83abbfa4ac6db77e (diff)
downloadgst-plugins-bad-f8781e3de80c7602f854e98d16ba72e7427e8887.tar.gz
gst-plugins-bad-f8781e3de80c7602f854e98d16ba72e7427e8887.tar.bz2
gst-plugins-bad-f8781e3de80c7602f854e98d16ba72e7427e8887.zip
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 <teuf@gnome.org> * 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...
-rw-r--r--ChangeLog13
-rw-r--r--ext/faac/gstfaac.c12
-rw-r--r--gst/mpeg2sub/gstmpeg2subt.c7
3 files changed, 27 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index c23146f7..9e1a5c62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2004-03-06 Christophe Fergeau <teuf@gnome.org>
+
+ * 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 <thomas at apestaart dot org>
* gst-libs/gst/media-info/media-info-priv.c: (have_type_callback),
diff --git a/ext/faac/gstfaac.c b/ext/faac/gstfaac.c
index 01eb03ad..7f536275 100644
--- a/ext/faac/gstfaac.c
+++ b/ext/faac/gstfaac.c
@@ -471,9 +471,13 @@ gst_faac_chain (GstPad *pad,
/* do we have enough data for one frame? */
if (in_size / faac->bps < faac->samples) {
if (in_size > size) {
+ GstBuffer *merge;
/* this is panic! we got a buffer, but still don't have enough
* data. Merge them and retry in the next cycle... */
- faac->cache = gst_buffer_merge (faac->cache, inbuf);
+ merge = gst_buffer_merge (faac->cache, inbuf);
+ gst_buffer_unref (faac->cache);
+ gst_buffer_unref (inbuf);
+ faac->cache = merge;
} else if (in_size == size) {
/* this shouldn't happen, but still... */
faac->cache = inbuf;
@@ -495,11 +499,15 @@ gst_faac_chain (GstPad *pad,
/* create the frame */
if (in_size > size) {
+ GstBuffer *merge;
/* merge */
subbuf = gst_buffer_create_sub (inbuf, 0, frame_size - (in_size - size));
GST_BUFFER_DURATION (subbuf) =
GST_BUFFER_DURATION (inbuf) * GST_BUFFER_SIZE (subbuf) / size;
- subbuf = gst_buffer_merge (faac->cache, subbuf);
+ merge = gst_buffer_merge (faac->cache, subbuf);
+ gst_buffer_unref (faac->cache);
+ gst_buffer_unref (subbuf);
+ subbuf = merge;
faac->cache = NULL;
} else {
subbuf = gst_buffer_create_sub (inbuf, size - in_size, frame_size);
diff --git a/gst/mpeg2sub/gstmpeg2subt.c b/gst/mpeg2sub/gstmpeg2subt.c
index 1774b13e..d267932a 100644
--- a/gst/mpeg2sub/gstmpeg2subt.c
+++ b/gst/mpeg2sub/gstmpeg2subt.c
@@ -369,10 +369,11 @@ gst_mpeg2subt_chain_subtitle (GstPad *pad, GstData *_data)
/* deal with partial frame from previous buffer */
if (mpeg2subt->partialbuf) {
-
- mpeg2subt->partialbuf = gst_buffer_merge(mpeg2subt->partialbuf, buf);
- /* and the one we received.. */
+ GstBuffer *merge;
+ merge = gst_buffer_merge(mpeg2subt->partialbuf, buf);
+ gst_buffer_unref (mpeg2subt->partialbuf);
gst_buffer_unref(buf);
+ mpeg2subt->partialbuf = merge;
}
else {
mpeg2subt->partialbuf = buf;