[vlc-commits] demux/ts.c: Handle allocation failures in Open()

Jean-Paul Saman git at videolan.org
Fri Feb 7 11:07:27 CET 2014


vlc | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Thu Feb  6 14:41:37 2014 +0100| [eec3b7c5111eebdd1e2f0ff86f3850612ca67c6f] | committer: Jean-Paul Saman

demux/ts.c: Handle allocation failures in Open()

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

 modules/demux/ts.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index 1c314bc..ca615c0 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -797,6 +797,12 @@ static int Open( vlc_object_t *p_this )
     p_sys->p_pcrs = (mtime_t *)calloc( p_sys->i_pcrs_num, sizeof( mtime_t ) );
     p_sys->p_pos = (int64_t *)calloc( p_sys->i_pcrs_num, sizeof( int64_t ) );
 
+    if( !p_sys->p_pcrs || !p_sys->p_pos )
+    {
+        Close( p_this );
+        return VLC_ENOMEM;
+    }
+
     bool can_seek = false;
     stream_Control( p_demux->s, STREAM_CAN_FASTSEEK, &can_seek );
     if( can_seek  )



More information about the vlc-commits mailing list