]> git.sesse.net Git - vlc/blobdiff - modules/demux/ts.c
Do not assert memory allocations
[vlc] / modules / demux / ts.c
index 7745445179a973b776abd2e9b5b942617e9b6b2e..43d829eb4f714fe4f1fff0c22a517e15b0127e0e 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_memory.h>
 
 #include <ctype.h>
 #include <assert.h>
@@ -516,10 +515,6 @@ static int Open( vlc_object_t *p_this )
         char *psz_event_text = malloc(130);
         char *psz_ext_text = malloc(1025);
 
-        assert( psz_name );
-        assert( psz_event_text );
-        assert( psz_ext_text );
-
         // 2 bytes version Uimsbf (4,5)
         // 2 bytes reserved (6,7)
         // 2 bytes duration in minutes Uimsbf (8,9(
@@ -623,8 +618,7 @@ static int Open( vlc_object_t *p_this )
             {
                 p_sys->i_ts_read = 1500 / p_sys->i_packet_size;
             }
-            p_sys->buffer = malloc( p_sys->i_packet_size * p_sys->i_ts_read );
-            assert( p_sys->buffer );
+            p_sys->buffer = xmalloc( p_sys->i_packet_size * p_sys->i_ts_read );
             msg_Info( p_demux, "%s raw stream to file `%s' reading packets %d",
                       b_append ? "appending" : "dumping", p_sys->psz_file,
                       p_sys->i_ts_read );
@@ -1554,7 +1548,7 @@ static void PIDInit( ts_pid_t *pid, bool b_psi, ts_psi_t *p_owner )
 
         if( !b_old_valid )
         {
-            pid->psi = malloc( sizeof( ts_psi_t ) );
+            pid->psi = xmalloc( sizeof( ts_psi_t ) );
             if( pid->psi )
             {
                 pid->psi->handle = NULL;
@@ -3024,9 +3018,8 @@ static void EITCallBack( demux_t *p_demux,
                         {
                             msg_Dbg( p_demux, "       - text='%s'", psz_text );
 
-                            psz_extra = realloc_or_free( psz_extra,
+                            psz_extra = xrealloc( psz_extra,
                                    strlen(psz_extra) + strlen(psz_text) + 1 );
-                            assert( psz_extra );
                             strcat( psz_extra, psz_text );
                             free( psz_text );
                         }
@@ -3042,10 +3035,9 @@ static void EITCallBack( demux_t *p_demux,
                         {
                             msg_Dbg( p_demux, "       - desc='%s' item='%s'", psz_dsc, psz_itm );
 #if 0
-                            psz_extra = realloc_or_free( psz_extra,
+                            psz_extra = xrealloc( psz_extra,
                                          strlen(psz_extra) + strlen(psz_dsc) +
                                          strlen(psz_itm) + 3 + 1 );
-                            assert( psz_extra );
                             strcat( psz_extra, "(" );
                             strcat( psz_extra, psz_dsc );
                             strcat( psz_extra, " " );