]> git.sesse.net Git - vlc/blobdiff - modules/packetizer/vc1.c
Do not assert memory allocations
[vlc] / modules / packetizer / vc1.c
index 3dc274e89952cc8993bf224f3d4fd1e181c08b30..679ee15f0cb3d5d6eb1f6a8dfc0d4d0095741fe0 100644 (file)
@@ -138,6 +138,8 @@ static int Open( vlc_object_t *p_this )
     /* Create the output format */
     es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
     p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
+    if( unlikely( !p_sys ) )
+        return VLC_ENOMEM;
 
     packetizer_Init( &p_sys->packetizer,
                      p_vc1_startcode, sizeof(p_vc1_startcode),
@@ -203,7 +205,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
     if( p_sys->b_check_startcode && pp_block && *pp_block )
     {
         /* Fix syntax for (some?) VC1 from asf */
-        const int i_startcode = sizeof(p_vc1_startcode);
+        const unsigned i_startcode = sizeof(p_vc1_startcode);
 
         block_t *p_block = *pp_block;
         if( p_block->i_buffer > 0 &&
@@ -309,7 +311,7 @@ static void BuildExtraData( decoder_t *p_dec )
     if( p_es->i_extra != i_extra )
     {
         p_es->i_extra = i_extra;
-        p_es->p_extra = realloc( p_dec->fmt_out.p_extra, p_es->i_extra );
+        p_es->p_extra = xrealloc( p_es->p_extra, p_es->i_extra );
     }
     memcpy( p_es->p_extra,
             p_sys->sh.p_sh->p_buffer, p_sys->sh.p_sh->i_buffer );