[vlc-commits] codec: zvbi: fix leak with vbi-text

Francois Cartegnie git at videolan.org
Mon Jul 15 08:51:59 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Jul 13 11:51:53 2019 +0200| [42b971f57e886ade47ba84a8115dffaadb3077c7] | committer: Francois Cartegnie

codec: zvbi: fix leak with vbi-text

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

 modules/codec/zvbi.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c
index 1b3cf8bd38..56e486439f 100644
--- a/modules/codec/zvbi.c
+++ b/modules/codec/zvbi.c
@@ -392,8 +392,6 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
                                 i_align, p_block->i_pts );
             if( !p_spu )
                 goto error;
-            subtext_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
-            p_spu_sys->region.p_segments = text_segment_New("");
 
             p_sys->b_update = true;
             p_sys->i_last_page = i_wanted_page;
@@ -451,7 +449,13 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
 
         subtext_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
         p_spu_sys->region.p_segments = text_segment_New( &p_text[offset] );
-        if( p_spu_sys->region.p_segments && b_opaque )
+        if( !p_spu_sys->region.p_segments )
+        {
+            subpicture_Delete( p_spu );
+            goto error;
+        }
+
+        if( b_opaque )
         {
             p_spu_sys->region.p_segments->style = text_style_Create( STYLE_NO_DEFAULTS );
             if( p_spu_sys->region.p_segments->style )



More information about the vlc-commits mailing list