[vlc-commits] voc: check ES

Rémi Denis-Courmont git at videolan.org
Thu May 3 14:28:24 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May  3 12:07:27 2018 +0300| [0d12b150747911a1facb869b4d1d78b9f287cdb4] | committer: Rémi Denis-Courmont

voc: check ES

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

 modules/demux/voc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/demux/voc.c b/modules/demux/voc.c
index 5298b23462..a3d0516cfb 100644
--- a/modules/demux/voc.c
+++ b/modules/demux/voc.c
@@ -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;



More information about the vlc-commits mailing list