Do not malloc(0) - to make valgrind not report 0 byte leaks
authorRafaël Carré <funman@videolan.org>
Mon, 26 May 2008 08:25:47 +0000 (10:25 +0200)
committerRafaël Carré <funman@videolan.org>
Mon, 26 May 2008 08:26:08 +0000 (10:26 +0200)
modules/demux/ts.c

index 7dc07ad..c7c1447 100644 (file)
@@ -3237,7 +3237,8 @@ static void PMTCallBack( demux_t *p_demux, dvbpsi_pmt_t *p_pmt )
                     pid->es->fmt.i_cat = SPU_ES;
                     pid->es->fmt.i_codec = VLC_FOURCC( 't', 'e', 'l', 'x' );
                     pid->es->fmt.i_extra = p_dr->i_length;
-                    pid->es->fmt.p_extra = malloc( p_dr->i_length );
+                    pid->es->fmt.p_extra = p_dr->i_length ?
+                        malloc( p_dr->i_length ) : NULL;
                     if( pid->es->fmt.p_extra )
                         memcpy( pid->es->fmt.p_extra, p_dr->p_data,
                                 p_dr->i_length );