]> git.sesse.net Git - vlc/blobdiff - modules/access_output/http.c
Do not assert memory allocations
[vlc] / modules / access_output / http.c
index b45ffe06744ebc3824bebbbbffc41df53d7762b9..fe2fe8b5c7e3771c826a00eae20145f4df635a17 100644 (file)
 # include "config.h"
 #endif
 
-#include <assert.h>
-
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
 #include <vlc_block.h>
+
+
 #include <vlc_input.h>
 #include <vlc_playlist.h>
-#include <vlc_memory.h>
 
 #if 0 //def HAVE_AVAHI_CLIENT
     #include "bonjour.h"
@@ -318,18 +317,13 @@ static int Open( vlc_object_t *p_this )
 
     p_sys->i_header_allocated = 1024;
     p_sys->i_header_size      = 0;
-    p_sys->p_header           = malloc( p_sys->i_header_allocated );
+    p_sys->p_header           = xmalloc( p_sys->i_header_allocated );
     p_sys->b_header_complete  = false;
-    if( !p_sys->p_header )
-        p_sys->i_header_allocated = 0;
 
     p_access->pf_write       = Write;
     p_access->pf_seek        = Seek;
     p_access->pf_control     = Control;
 
-    /* XXX Do we deal gracefully with p_sys->p_header == NULL? */
-    assert( p_sys->p_header );
-
     return VLC_SUCCESS;
 }
 
@@ -399,9 +393,8 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer )
             {
                 p_sys->i_header_allocated =
                     p_buffer->i_buffer + p_sys->i_header_size + 1024;
-                p_sys->p_header = realloc_or_free( p_sys->p_header,
+                p_sys->p_header = xrealloc( p_sys->p_header,
                                                   p_sys->i_header_allocated );
-                assert( p_sys->p_header );
             }
             memcpy( &p_sys->p_header[p_sys->i_header_size],
                     p_buffer->p_buffer,