]> git.sesse.net Git - vlc/commitdiff
mux: mp4: check alloc result before use
authorFrancois Cartegnie <fcvlcdev@free.fr>
Tue, 10 Jun 2014 16:11:49 +0000 (18:11 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Tue, 10 Jun 2014 18:37:02 +0000 (20:37 +0200)
modules/mux/mp4.c

index 47a3e7302205b334709e360c8a1415e59c713559..9e00b001f7b9ecf4824e11a6ab7e325be6a55bd0 100644 (file)
@@ -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] = ' ';