[vlc-devel] commit: Do not malloc(0) - to make valgrind not report 0 byte leaks ( Rafaël Carré )

git version control git at videolan.org
Mon May 26 10:25:02 CEST 2008


vlc | branch: 0.8.6-bugfix | Rafaël Carré <funman at videolan.org> | Mon May 26 10:25:47 2008 +0200| [30b63bf1d4eaba385699c7677efc43bc18b18aa6]

Do not malloc(0) - to make valgrind not report 0 byte leaks
(cherry picked from commit 69b32f594f9440af60885ff4006af756b05a208b)

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

 modules/demux/ts.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index e6e5a3f..09902a9 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -3244,7 +3244,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 );




More information about the vlc-devel mailing list