]> git.sesse.net Git - vlc/blobdiff - modules/mux/mp4.c
Replace argument = realloc( argument, size ); with realloc_or_free() in modules/...
[vlc] / modules / mux / mp4.c
index d59c90d706144f5957536c4806dc7fa9a6b7bf47..13e72fa290e2a111d82f88732defe0dd4734f7e2 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_memory.h>
 
 #include <time.h>
 
@@ -597,9 +600,9 @@ again:
         if( p_stream->i_entry_count >= p_stream->i_entry_max - 1 )
         {
             p_stream->i_entry_max += 1000;
-            p_stream->entry =
-                realloc( p_stream->entry,
+            p_stream->entry = realloc_or_free( p_stream->entry,
                          p_stream->i_entry_max * sizeof( mp4_entry_t ) );
+            assert( p_stream->entry );
         }
 
         /* update */
@@ -1948,6 +1951,7 @@ static void bo_init( bo_t *p_bo, int i_size, uint8_t *p_buffer,
     {
         p_bo->i_buffer_size = __MAX( i_size, 1024 );
         p_bo->p_buffer = malloc( p_bo->i_buffer_size );
+        assert( p_bo->p_buffer );
     }
     else
     {
@@ -1968,8 +1972,8 @@ static void bo_add_8( bo_t *p_bo, uint8_t i )
     else if( p_bo->b_grow )
     {
         p_bo->i_buffer_size += 1024;
-        p_bo->p_buffer = realloc( p_bo->p_buffer, p_bo->i_buffer_size );
-
+        p_bo->p_buffer = realloc_or_free( p_bo->p_buffer, p_bo->i_buffer_size );
+        assert( p_bo->p_buffer );
         p_bo->p_buffer[p_bo->i_buffer] = i;
     }