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

Filip Roséen filip at atch.se
Wed Mar 1 10:33:31 CET 2017


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.
---
 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 e757d6b2cf..8f43ffeb29 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 );
-- 
2.12.0



More information about the vlc-devel mailing list