[vlc-commits] Fix potential memleak (cid #1049846)

Rémi Duraffort git at videolan.org
Sat Jul 13 23:37:34 CEST 2013


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sat Jul 13 23:09:55 2013 +0200| [0f14935d6a3c4cd56936e3e7d28d0f264b24728e] | committer: Rémi Duraffort

Fix potential memleak (cid #1049846)

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

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

diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index caa0e49..a6ccb52 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -1234,11 +1234,10 @@ static int UserPmt( demux_t *p_demux, const char *psz_fmt )
     PIDInit( pmt, true, NULL );
 
     /* Dummy PMT */
-    prg = malloc( sizeof( ts_prg_psi_t ) );
+    prg = calloc( 1, sizeof( ts_prg_psi_t ) );
     if( !prg )
         goto error;
 
-    memset( prg, 0, sizeof( ts_prg_psi_t ) );
     prg->i_pid_pcr  = -1;
     prg->i_pid_pmt  = -1;
     prg->i_version  = -1;
@@ -1341,6 +1340,7 @@ static int UserPmt( demux_t *p_demux, const char *psz_fmt )
     return VLC_SUCCESS;
 
 error:
+    free( prg );
     free( psz_dup );
     return VLC_EGENERIC;
 }



More information about the vlc-commits mailing list