[vlc-devel] commit: Check after calloc to avoid null dereference. (Jean-Baptiste Kempf )

git version control git at videolan.org
Tue Mar 11 02:57:52 CET 2008


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Mar 10 18:55:00 2008 -0700| [1703d8421a3b582da45c837f42e04d1ea0e8d609]

Check after calloc to avoid null dereference.
Should Close #1499

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1703d8421a3b582da45c837f42e04d1ea0e8d609
---

 modules/demux/real.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/modules/demux/real.c b/modules/demux/real.c
index 12d4e32..a919680 100644
--- a/modules/demux/real.c
+++ b/modules/demux/real.c
@@ -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 );




More information about the vlc-devel mailing list