]> git.sesse.net Git - vlc/commitdiff
Check after calloc to avoid null dereference.
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 11 Mar 2008 01:55:00 +0000 (18:55 -0700)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 11 Mar 2008 01:55:00 +0000 (18:55 -0700)
Should Close #1499

modules/demux/real.c

index 12d4e32a14e77b80312593165d429140808f8b45..a919680367d3b1bc1a8e30d91303c91b5f65a050 100644 (file)
@@ -1244,6 +1244,14 @@ static int ReadCodecSpecificData( demux_t *p_demux, int i_len, int i_num )
                     calloc( tk->i_subpackets, sizeof(block_t *) );
             }
 
+            /* Check if the calloc went correctly */
+            if( tk->p_subpackets == NULL )
+            {
+                tk->i_subpackets = 0;
+                msg_Err( p_demux, "Can't alloc subpacket" );
+                return VLC_EGENERIC;
+            }
+
             tk->p_es = es_out_Add( p_demux->out, &fmt );
 
             TAB_APPEND( p_sys->i_track, p_sys->track, tk );