[vlc-commits] mpeg_audio: assume block_GetBytes can fail
Rafaël Carré
git at videolan.org
Tue Nov 12 11:55:20 CET 2013
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue Nov 12 11:50:46 2013 +0100| [ddc3eafec7d1283fe5da89cab7628c8fa268bc57] | committer: Rafaël Carré
mpeg_audio: assume block_GetBytes can fail
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ddc3eafec7d1283fe5da89cab7628c8fa268bc57
---
modules/codec/mpeg_audio.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/modules/codec/mpeg_audio.c b/modules/codec/mpeg_audio.c
index b455849..cced5ad 100644
--- a/modules/codec/mpeg_audio.c
+++ b/modules/codec/mpeg_audio.c
@@ -448,10 +448,12 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
p_sys->i_free_frame_size = p_sys->i_frame_size;
}
- /* Copy the whole frame into the buffer. When we reach this point
- * we already know we have enough data available. */
- block_GetBytes( &p_sys->bytestream,
- p_buf, __MIN( (unsigned)p_sys->i_frame_size, p_out_buffer->i_buffer ) );
+ /* Copy the whole frame into the buffer. */
+ if (block_GetBytes( &p_sys->bytestream,
+ p_buf, __MIN( (unsigned)p_sys->i_frame_size, p_out_buffer->i_buffer ) )) {
+ block_Release(p_out_buffer);
+ return NULL;
+ }
/* Get beginning of next frame for libmad */
if( !p_sys->b_packetizer )
More information about the vlc-commits
mailing list