[vlc-commits] mux: mp4: check alloc result before use

Francois Cartegnie git at videolan.org
Tue Jun 10 20:37:16 CEST 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Jun 10 18:11:49 2014 +0200| [09a135f125ccde6937ab4fe6cf9323f389eedf38] | committer: Francois Cartegnie

mux: mp4: check alloc result before use

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=09a135f125ccde6937ab4fe6cf9323f389eedf38
---

 modules/mux/mp4.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/modules/mux/mp4.c b/modules/mux/mp4.c
index 47a3e73..9e00b00 100644
--- a/modules/mux/mp4.c
+++ b/modules/mux/mp4.c
@@ -537,7 +537,7 @@ static int Mux(sout_mux_t *p_mux)
         if (p_stream->fmt.i_cat == SPU_ES) {
             int64_t i_length = p_stream->entry[p_stream->i_entry_count-1].i_length;
 
-            if (i_length != 0) {
+            if ( i_length != 0 && (p_data = block_Alloc(3)) ) {
                 /* TODO */
                 msg_Dbg(p_mux, "writing an empty sub") ;
 
@@ -556,7 +556,6 @@ static int Mux(sout_mux_t *p_mux)
                 p_stream->i_last_dts += i_length;
 
                 /* Write a " " */
-                p_data = block_Alloc(3);
                 p_data->p_buffer[0] = 0;
                 p_data->p_buffer[1] = 1;
                 p_data->p_buffer[2] = ' ';



More information about the vlc-commits mailing list