[vlc-devel] commit: vobsub: strdup memleak (stream_Add copies the format) ( Derk-Jan Hartman )

git version control git at videolan.org
Mon Jun 1 13:25:11 CEST 2009


vlc | branch: 1.0-bugfix | Derk-Jan Hartman <hartman at videolan.org> | Mon Jun  1 11:58:30 2009 +0200| [1f8a2e2d7708375a631363ecf517db5864d7c7cf] | committer: Derk-Jan Hartman 

vobsub: strdup memleak (stream_Add copies the format)
(cherry picked from commit f8bc94143ea531b39ef2eaf651154af316e1e2e4)

Signed-off-by: Derk-Jan Hartman <hartman at videolan.org>

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

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

diff --git a/modules/demux/vobsub.c b/modules/demux/vobsub.c
index 3b90e2d..bb0a47e 100644
--- a/modules/demux/vobsub.c
+++ b/modules/demux/vobsub.c
@@ -537,7 +537,7 @@ static int ParseVobSubIDX( demux_t *p_demux )
         }
         else if( !strncmp( "id:", line, 3 ) )
         {
-            char language[20];
+            char language[3];
             int i_track_id;
             es_format_t fmt;
 
@@ -547,6 +547,7 @@ static int ParseVobSubIDX( demux_t *p_demux )
             {
                 p_sys->i_tracks++;
                 p_sys->track = realloc( p_sys->track, sizeof( vobsub_track_t ) * (p_sys->i_tracks + 1 ) );
+                language[2] = '\0';
 
                 /* Init the track */
                 current_tk = &p_sys->track[p_sys->i_tracks - 1];
@@ -560,7 +561,7 @@ static int ParseVobSubIDX( demux_t *p_demux )
                 es_format_Init( &fmt, SPU_ES, VLC_FOURCC( 's','p','u',' ' ) );
                 fmt.subs.spu.i_original_frame_width = p_sys->i_original_frame_width;
                 fmt.subs.spu.i_original_frame_height = p_sys->i_original_frame_height;
-                fmt.psz_language = strdup( language );
+                fmt.psz_language = language;
                 if( p_sys->b_palette )
                 {
                     fmt.subs.spu.palette[0] = 0xBeef;




More information about the vlc-devel mailing list