[vlc-commits] ttml demux: Fix potential memory leak

Hugo Beauzée-Luyssen git at videolan.org
Wed Sep 14 18:39:45 CEST 2016


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Sep 13 11:42:12 2016 +0200| [632ebc4e98c7c9ddad7466f51c5dd080ffe6250f] | committer: Hugo Beauzée-Luyssen

ttml demux: Fix potential memory leak

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

 modules/demux/ttml.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/demux/ttml.c b/modules/demux/ttml.c
index 2407c25..88e2fec 100644
--- a/modules/demux/ttml.c
+++ b/modules/demux/ttml.c
@@ -631,10 +631,11 @@ static int ReadTTML( demux_t* p_demux )
                     if( p_sys->i_subtitles >= i_max_sub )
                     {
                         i_max_sub += 500;
-                        p_sys->subtitle = realloc_or_free( p_sys->subtitle,
+                        subtitle_t* p_subtitles = realloc( p_sys->subtitle,
                                 sizeof( *p_sys->subtitle ) * i_max_sub );
-                        if( unlikely( p_sys->subtitle == NULL ) )
+                        if( unlikely( p_subtitles == NULL ) )
                             goto error;
+                        p_sys->subtitle = p_subtitles;
                     }
                     subtitle_t *p_subtitle = &p_sys->subtitle[p_sys->i_subtitles];
 



More information about the vlc-commits mailing list