ext/vorbis/vorbisenc.c: fix buffer unreffing on a header push failure

Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_chain):
fix buffer unreffing on a header push failure
This commit is contained in:
Thomas Vander Stichele 2006-08-29 08:03:05 +00:00
parent 9838aef96c
commit 1eb2a25683
2 changed files with 13 additions and 8 deletions

View file

@ -1,3 +1,8 @@
2006-08-29 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_chain):
fix buffer unreffing on a header push failure
2006-08-28 Wim Taymans <wim@fluendo.com> 2006-08-28 Wim Taymans <wim@fluendo.com>
* gst/audiorate/gstaudiorate.c: (gst_audio_rate_sink_event), * gst/audiorate/gstaudiorate.c: (gst_audio_rate_sink_event),

View file

@ -1091,16 +1091,17 @@ gst_vorbis_enc_chain (GstPad * pad, GstBuffer * buffer)
gst_buffer_set_caps (buf3, caps); gst_buffer_set_caps (buf3, caps);
/* push out buffers */ /* push out buffers */
/* push_buffer takes the reference even for failure */
if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf1)) != GST_FLOW_OK) if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf1)) != GST_FLOW_OK)
goto failed_header_push; goto failed_header_push;
buf1 = NULL; if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf2)) != GST_FLOW_OK) {
if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf2)) != GST_FLOW_OK)
goto failed_header_push;
buf2 = NULL; buf2 = NULL;
if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf3)) != GST_FLOW_OK)
goto failed_header_push; goto failed_header_push;
}
if ((ret = gst_vorbis_enc_push_buffer (vorbisenc, buf3)) != GST_FLOW_OK) {
buf3 = NULL; buf3 = NULL;
goto failed_header_push;
}
/* now adjust starting granulepos accordingly if the buffer's timestamp is /* now adjust starting granulepos accordingly if the buffer's timestamp is
nonzero */ nonzero */
@ -1186,8 +1187,7 @@ not_setup:
failed_header_push: failed_header_push:
{ {
GST_WARNING_OBJECT (vorbisenc, "Failed to push headers"); GST_WARNING_OBJECT (vorbisenc, "Failed to push headers");
if (buf1) /* buf1 is always already unreffed */
gst_buffer_unref (buf1);
if (buf2) if (buf2)
gst_buffer_unref (buf2); gst_buffer_unref (buf2);
if (buf3) if (buf3)