voc: check ES
authorRémi Denis-Courmont <remi@remlab.net>
Thu, 3 May 2018 09:07:27 +0000 (12:07 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Thu, 3 May 2018 12:25:37 +0000 (15:25 +0300)
modules/demux/voc.c

index 5298b23..a3d0516 100644 (file)
@@ -29,6 +29,8 @@
 # include "config.h"
 #endif
 
+#include <assert.h>
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_demux.h>
@@ -450,6 +452,8 @@ static int ReadBlockHeader( demux_t *p_demux )
             memcpy( &p_sys->fmt, &new_fmt, sizeof( p_sys->fmt ) );
             date_Change( &p_sys->pts, p_sys->fmt.audio.i_rate, 1 );
             p_sys->p_es = es_out_Add( p_demux->out, &p_sys->fmt );
+            if( unlikely(p_sys->p_es == NULL) )
+                return VLC_ENOMEM;
         }
     }
 
@@ -515,6 +519,7 @@ static int Demux( demux_t *p_demux )
     p_block->i_nb_samples = i_read_frames * p_sys->fmt.audio.i_frame_length;
     date_Increment( &p_sys->pts, p_block->i_nb_samples );
     es_out_SetPCR( p_demux->out, p_block->i_pts );
+    assert(p_sys->p_es != NULL);
     es_out_Send( p_demux->out, p_sys->p_es, p_block );
 
     return VLC_DEMUXER_SUCCESS;