[vlc-devel] [PATCH] access: dtv: fix realloc usage

Steve Lhomme robux4 at videolabs.io
Thu Apr 28 16:22:40 CEST 2016


---
 modules/access/dtv/en50221_capmt.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/access/dtv/en50221_capmt.h b/modules/access/dtv/en50221_capmt.h
index 9b4878d..87b8eeb 100644
--- a/modules/access/dtv/en50221_capmt.h
+++ b/modules/access/dtv/en50221_capmt.h
@@ -56,11 +56,12 @@ static inline en50221_capmt_es_info_t *en50221_capmt_EsAdd( en50221_capmt_info_t
                                                             uint8_t i_stream_type,
                                                             uint16_t i_es_pid )
 {
-    en50221_capmt_es_info_t *p_realloc = realloc( p_en->p_es, p_en->i_es_count + 1 );
+    en50221_capmt_es_info_t *p_realloc = realloc( p_en->p_es, sizeof(en50221_capmt_es_info_t) *
+                                                              (p_en->i_es_count + 1) );
     if( likely(p_realloc) )
     {
         p_en->p_es = p_realloc;
-        en50221_capmt_es_info_t *p_es = &p_en->p_es[ p_en->i_es_count ];
+        en50221_capmt_es_info_t *p_es = &p_en->p_es[ p_en->i_es_count++ ];
         p_es->i_es_pid = i_es_pid;
         p_es->i_stream_type = i_stream_type;
         p_es->i_descriptors = 0;
-- 
2.7.0



More information about the vlc-devel mailing list