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

Rémi Duraffort git at videolan.org
Sun Jul 14 12:04:08 CEST 2013


vlc/vlc-2.1 | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sat Jul 13 23:09:55 2013 +0200| [ea8deb834e78912a57fa007aa8e2b40a01bb41e6] | committer: Jean-Baptiste Kempf

Fix potential memleak (cid #1049846)

(cherry picked from commit 0f14935d6a3c4cd56936e3e7d28d0f264b24728e)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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