[vlc-commits] mux/mpeg: BuildPMT: prevent allocation of unnecessary data

Filip Roséen git at videolan.org
Wed Mar 1 17:43:20 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Wed Mar  1 10:33:31 2017 +0100| [22e6c0c11036f5a487e8be86b9eec81a069942b8] | committer: Jean-Baptiste Kempf

mux/mpeg: BuildPMT: prevent allocation of unnecessary data

pi_service_types is of type pointer-to-uint8_t, so the previous
implementation would allocate far more memory (as a pointer is bigger
than uint8_t) than what is actually required.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/mux/mpeg/tables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/mux/mpeg/tables.c b/modules/mux/mpeg/tables.c
index e757d6b..8f43ffe 100644
--- a/modules/mux/mpeg/tables.c
+++ b/modules/mux/mpeg/tables.c
@@ -374,7 +374,7 @@ void BuildPMT( dvbpsi_t *p_dvbpsi, vlc_object_t *p_object,
     if( p_sdt )
     {
         dvbpsi_sdt_init( &sdtpsi, 0x42, i_tsid, 1, true, p_sdt->i_netid );
-        pi_service_types = calloc( i_programs * 2, sizeof(uint8_t *) );
+        pi_service_types = calloc( i_programs * 2, sizeof *pi_service_types );
         if( !pi_service_types )
         {
             free( dvbpmt );



More information about the vlc-commits mailing list