]> git.sesse.net Git - vlc/blobdiff - modules/demux/live555.cpp
Do not assert memory allocations
[vlc] / modules / demux / live555.cpp
index cdf6adbe6bc6ba0bae6daf6507c59f8fb2ef809f..abc0eddec9bd8f82b4e9cf543e01cf72d31f7446 100644 (file)
@@ -45,7 +45,6 @@
 #include <vlc_dialog.h>
 #include <vlc_url.h>
 #include <vlc_strings.h>
-#include <vlc_memory.h>
 
 #include <iostream>
 #include <limits.h>
@@ -368,8 +367,7 @@ static int  Open ( vlc_object_t *p_this )
             }
 
             i_sdp_max += 1000;
-            p_sdp = (uint8_t*)realloc_or_free( p_sdp, i_sdp_max );
-            assert( p_sdp );
+            p_sdp = (uint8_t*)xrealloc( p_sdp, i_sdp_max );
         }
         p_sys->p_sdp = (char*)p_sdp;
     }
@@ -868,8 +866,7 @@ static int SessionsSetup( demux_t *p_demux )
                                                              i_extra ) ) )
                     {
                         tk->fmt.i_extra = i_extra;
-                        tk->fmt.p_extra = malloc( i_extra );
-                        assert( tk->fmt.p_extra );
+                        tk->fmt.p_extra = xmalloc( i_extra );
                         memcpy( tk->fmt.p_extra, p_extra, i_extra );
                         delete[] p_extra;
                     }
@@ -889,8 +886,7 @@ static int SessionsSetup( demux_t *p_demux )
                                                            i_extra ) ) )
                     {
                         tk->fmt.i_extra = i_extra;
-                        tk->fmt.p_extra = malloc( i_extra );
-                        assert( tk->fmt.p_extra );
+                        tk->fmt.p_extra = xmalloc( i_extra );
                         memcpy( tk->fmt.p_extra, p_extra, i_extra );
                         delete[] p_extra;
                     }
@@ -948,8 +944,7 @@ static int SessionsSetup( demux_t *p_demux )
                                                     i_extra ) ) )
                     {
                         tk->fmt.i_extra = i_extra;
-                        tk->fmt.p_extra = malloc( i_extra );
-                        assert( tk->fmt.p_extra );
+                        tk->fmt.p_extra = xmalloc( i_extra );
                         memcpy( tk->fmt.p_extra, p_extra, i_extra );
 
                         delete[] p_extra;
@@ -970,8 +965,7 @@ static int SessionsSetup( demux_t *p_demux )
                                                            i_extra ) ) )
                     {
                         tk->fmt.i_extra = i_extra;
-                        tk->fmt.p_extra = malloc( i_extra );
-                        assert( tk->fmt.p_extra );
+                        tk->fmt.p_extra = xmalloc( i_extra );
                         memcpy( tk->fmt.p_extra, p_extra, i_extra );
                         delete[] p_extra;
                     }
@@ -1034,9 +1028,8 @@ static int SessionsSetup( demux_t *p_demux )
             if( tk->p_es || tk->b_quicktime || tk->b_muxed || tk->b_asf )
             {
                 /* Append */
-                p_sys->track = (live_track_t**)realloc_or_free( p_sys->track,
+                p_sys->track = (live_track_t**)xrealloc( p_sys->track,
                             sizeof( live_track_t ) * ( p_sys->i_track + 1 ) );
-                assert( p_sys->track );
                 p_sys->track[p_sys->i_track++] = tk;
             }
             else
@@ -1625,8 +1618,7 @@ static void StreamRead( void *p_private, unsigned int i_size,
                         atomLength <= INT_MAX )
                     {
                         tk->fmt.i_extra = atomLength-8;
-                        tk->fmt.p_extra = malloc( tk->fmt.i_extra );
-                        assert( tk->fmt.p_extra );
+                        tk->fmt.p_extra = xmalloc( tk->fmt.i_extra );
                         memcpy(tk->fmt.p_extra, pos+8, atomLength-8);
                         break;
                     }
@@ -1636,8 +1628,7 @@ static void StreamRead( void *p_private, unsigned int i_size,
             else
             {
                 tk->fmt.i_extra        = qtState.sdAtomSize - 16;
-                tk->fmt.p_extra        = malloc( tk->fmt.i_extra );
-                assert( tk->fmt.p_extra );
+                tk->fmt.p_extra        = xmalloc( tk->fmt.i_extra );
                 memcpy( tk->fmt.p_extra, &sdAtom[12], tk->fmt.i_extra );
             }
         }